PropertyBuilder<TProperty>.HasValueGeneratorFactory Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
HasValueGeneratorFactory(Type) |
Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property. |
HasValueGeneratorFactory<TFactory>() |
Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property. |
HasValueGeneratorFactory(Type)
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasValueGeneratorFactory (Type? valueGeneratorFactoryType);
override this.HasValueGeneratorFactory : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasValueGeneratorFactory (valueGeneratorFactoryType As Type) As PropertyBuilder(Of TProperty)
Parameters
- valueGeneratorFactoryType
- Type
A type that inherits from ValueGeneratorFactory.
Returns
The same builder instance so that multiple configuration calls can be chained.
Remarks
Values are generated when the entity is added to the context using, for example, Add<TEntity>(TEntity). Values are generated only when the property is assigned the CLR default value (null
for string
, 0
for int
, Guid.Empty
for Guid
, etc.).
A single instance of this type will be created and used to generate values for this property in all instances of the entity type. The type must be instantiable and have a parameterless constructor.
This method is intended for use with custom value generation. Value generation for common cases is usually handled automatically by the database provider.
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.
Applies to
HasValueGeneratorFactory<TFactory>()
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
- Source:
- PropertyBuilder%60.cs
Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasValueGeneratorFactory<TFactory> () where TFactory : Microsoft.EntityFrameworkCore.ValueGeneration.ValueGeneratorFactory;
override this.HasValueGeneratorFactory : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> (requires 'Factory :> Microsoft.EntityFrameworkCore.ValueGeneration.ValueGeneratorFactory)
Public Overridable Function HasValueGeneratorFactory(Of TFactory As ValueGeneratorFactory) () As PropertyBuilder(Of TProperty)
Type Parameters
- TFactory
A type that inherits from ValueGeneratorFactory.
Returns
The same builder instance so that multiple configuration calls can be chained.
Remarks
Values are generated when the entity is added to the context using, for example, Add<TEntity>(TEntity). Values are generated only when the property is assigned the CLR default value (null
for string
, 0
for int
, Guid.Empty
for Guid
, etc.).
A single instance of this type will be created and used to generate values for this property in all instances of the entity type. The type must be instantiable and have a parameterless constructor.
This method is intended for use with custom value generation. Value generation for common cases is usually handled automatically by the database provider.
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.
Applies to
Entity Framework