Condividi tramite


RuntimeTypeBase.AddProperty Metodo

Definizione

Aggiunge una proprietà a questo tipo di entità.

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty AddProperty (string name, Type clrType, System.Reflection.PropertyInfo? propertyInfo = default, System.Reflection.FieldInfo? fieldInfo = default, Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, bool nullable = false, bool concurrencyToken = false, Microsoft.EntityFrameworkCore.Metadata.ValueGenerated valueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior beforeSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior afterSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, int? maxLength = default, bool? unicode = default, int? precision = default, int? scale = default, Type? providerPropertyType = default, Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.ITypeBase,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>? valueGeneratorFactory = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? valueConverter = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? keyValueComparer = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerValueComparer = default, Microsoft.EntityFrameworkCore.Storage.Json.JsonValueReaderWriter? jsonValueReaderWriter = default, Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping? typeMapping = default, object? sentinel = default);
abstract member AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.ITypeBase, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.Json.JsonValueReaderWriter * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping * obj -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
override this.AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.ITypeBase, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.Json.JsonValueReaderWriter * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping * obj -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
Public Overridable Function AddProperty (name As String, clrType As Type, Optional propertyInfo As PropertyInfo = Nothing, Optional fieldInfo As FieldInfo = Nothing, Optional propertyAccessMode As PropertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, Optional nullable As Boolean = false, Optional concurrencyToken As Boolean = false, Optional valueGenerated As ValueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Optional beforeSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional afterSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional maxLength As Nullable(Of Integer) = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional precision As Nullable(Of Integer) = Nothing, Optional scale As Nullable(Of Integer) = Nothing, Optional providerPropertyType As Type = Nothing, Optional valueGeneratorFactory As Func(Of IProperty, ITypeBase, ValueGenerator) = Nothing, Optional valueConverter As ValueConverter = Nothing, Optional valueComparer As ValueComparer = Nothing, Optional keyValueComparer As ValueComparer = Nothing, Optional providerValueComparer As ValueComparer = Nothing, Optional jsonValueReaderWriter As JsonValueReaderWriter = Nothing, Optional typeMapping As CoreTypeMapping = Nothing, Optional sentinel As Object = Nothing) As RuntimeProperty

Parametri

name
String

Nome della proprietà da aggiungere.

clrType
Type

Il tipo di valore che la proprietà conterrà.

propertyInfo
PropertyInfo

Proprietà CLR corrispondente o null per una proprietà shadow.

fieldInfo
FieldInfo

Campo CLR corrispondente o null per una proprietà shadow.

propertyAccessMode
PropertyAccessMode

Oggetto PropertyAccessMode utilizzato per questa proprietà.

nullable
Boolean

Valore che indica se questa proprietà può contenere null.

concurrencyToken
Boolean

Valore che indica se questa proprietà viene usata come token di concorrenza.

valueGenerated
ValueGenerated

Valore che indica quando verrà generato un valore per questa proprietà dal database.

beforeSaveBehavior
PropertySaveBehavior

Valore che indica se questa proprietà può essere modificata prima che l'entità venga salvata nel database.

afterSaveBehavior
PropertySaveBehavior

Valore che indica se questa proprietà può essere modificata dopo il salvataggio dell'entità nel database.

maxLength
Nullable<Int32>

Lunghezza massima dei dati consentiti in questa proprietà.

unicode
Nullable<Boolean>

Valore che indica se la proprietà può rendere persistenti i caratteri Unicode.

precision
Nullable<Int32>

Precisione dei dati consentiti in questa proprietà.

scale
Nullable<Int32>

Scala dei dati consentiti in questa proprietà.

providerPropertyType
Type

Tipo in cui verrà convertito il valore della proprietà prima di essere inviato al provider di database.

valueGeneratorFactory
Func<IProperty,ITypeBase,ValueGenerator>

Factory impostata per generare valori per questa proprietà, se presente.

valueConverter
ValueConverter

Set personalizzato ValueConverter per questa proprietà.

valueComparer
ValueComparer

Oggetto ValueComparer per questa proprietà.

keyValueComparer
ValueComparer

Oggetto ValueComparer da usare con chiavi per questa proprietà.

providerValueComparer
ValueComparer

Oggetto ValueComparer da usare per i valori del provider per questa proprietà.

jsonValueReaderWriter
JsonValueReaderWriter

Oggetto JsonValueReaderWriter per questa proprietà.

typeMapping
CoreTypeMapping

Oggetto CoreTypeMapping per questa proprietà.

sentinel
Object

Valore della proprietà da usare per considerare la proprietà non impostata.

Restituisce

Proprietà appena creata.

Si applica a