Dela via


ConventionPropertyExtensions.SetValueGeneratorFactory Method

Definition

Sets the factory to use for generating values for this property, or null to clear any previously set factory.

Setting null does not disable value generation for this property, it just clears any generator explicitly configured for this property. The database provider may still have a value generator for the property type.

public static void SetValueGeneratorFactory (this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> valueGeneratorFactory, bool fromDataAnnotation = false);
public static Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> SetValueGeneratorFactory (this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> valueGeneratorFactory, bool fromDataAnnotation = false);
static member SetValueGeneratorFactory : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * bool -> unit
static member SetValueGeneratorFactory : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * bool -> Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>
<Extension()>
Public Sub SetValueGeneratorFactory (property As IConventionProperty, valueGeneratorFactory As Func(Of IProperty, IEntityType, ValueGenerator), Optional fromDataAnnotation As Boolean = false)
<Extension()>
Public Function SetValueGeneratorFactory (property As IConventionProperty, valueGeneratorFactory As Func(Of IProperty, IEntityType, ValueGenerator), Optional fromDataAnnotation As Boolean = false) As Func(Of IProperty, IEntityType, ValueGenerator)

Parameters

property
IConventionProperty

The property to set the value generator for.

valueGeneratorFactory
Func<IProperty,IEntityType,ValueGenerator>

A factory that will be used to create the value generator, or null to clear any previously set factory.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The configured value.

Applies to