共用方式為


RuntimeEntityType.AddServiceProperty 方法

定義

多載

AddServiceProperty(String, PropertyInfo, FieldInfo, PropertyAccessMode)

將服務屬性加入至此實體類型。

AddServiceProperty(String, PropertyInfo, FieldInfo, Type, PropertyAccessMode)

將服務屬性加入至此實體類型。

AddServiceProperty(String, PropertyInfo, FieldInfo, PropertyAccessMode)

將服務屬性加入至此實體類型。

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty AddServiceProperty (string name, System.Reflection.PropertyInfo? propertyInfo = default, System.Reflection.FieldInfo? fieldInfo = default, Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField);
abstract member AddServiceProperty : string * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty
override this.AddServiceProperty : string * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty
Public Overridable Function AddServiceProperty (name As String, Optional propertyInfo As PropertyInfo = Nothing, Optional fieldInfo As FieldInfo = Nothing, Optional propertyAccessMode As PropertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField) As RuntimeServiceProperty

參數

name
String

要加入的屬性名稱。

propertyInfo
PropertyInfo

對應的 CLR 屬性或 null 陰影屬性。

fieldInfo
FieldInfo

陰影屬性的對應 CLR 欄位或 null

propertyAccessMode
PropertyAccessMode

PropertyAccessMode用於這個屬性的 。

傳回

新建立的服務屬性。

適用於

AddServiceProperty(String, PropertyInfo, FieldInfo, Type, PropertyAccessMode)

將服務屬性加入至此實體類型。

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty AddServiceProperty (string name, System.Reflection.PropertyInfo? propertyInfo = default, System.Reflection.FieldInfo? fieldInfo = default, Type? serviceType = default, Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField);
abstract member AddServiceProperty : string * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Type * Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty
override this.AddServiceProperty : string * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Type * Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.Metadata.RuntimeServiceProperty
Public Overridable Function AddServiceProperty (name As String, Optional propertyInfo As PropertyInfo = Nothing, Optional fieldInfo As FieldInfo = Nothing, Optional serviceType As Type = Nothing, Optional propertyAccessMode As PropertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField) As RuntimeServiceProperty

參數

name
String

要加入的屬性名稱。

propertyInfo
PropertyInfo

對應的 CLR 屬性或 null 陰影屬性。

fieldInfo
FieldInfo

陰影屬性的對應 CLR 欄位或 null

serviceType
Type

服務的型別,或使用 null 成員的類型。

propertyAccessMode
PropertyAccessMode

PropertyAccessMode用於這個屬性的 。

傳回

新建立的服務屬性。

適用於