共用方式為


DbModelBuilder.Entity<TEntityType> 方法

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

註冊實體類型當做模型的一部分,並傳回可用來設定實體的物件。 可針對相同的實體多次呼叫此方法,以執行多行組態。

命名空間:  System.Data.Entity
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Overridable Function Entity(Of TEntityType As Class) As EntityTypeConfiguration(Of TEntityType)
'用途
Dim instance As DbModelBuilder 
Dim returnValue As EntityTypeConfiguration(Of TEntityType)

returnValue = instance.Entity()
public virtual EntityTypeConfiguration<TEntityType> Entity<TEntityType>()
where TEntityType : class
public:
generic<typename TEntityType>
where TEntityType : ref class 
virtual EntityTypeConfiguration<TEntityType>^ Entity()
abstract Entity : unit -> EntityTypeConfiguration<'TEntityType>  when 'TEntityType : not struct 
override Entity : unit -> EntityTypeConfiguration<'TEntityType>  when 'TEntityType : not struct
JScript does not support generic types and methods.

類型參數

  • TEntityType
    要登錄或設定的類型。

傳回值

類型:System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TEntityType>
指定之實體類型的組態物件。

請參閱

參考

DbModelBuilder 類別

System.Data.Entity 命名空間