ComplexTypePrimitiveCollectionBuilder.HasValueGenerator 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
HasValueGenerator(Type) |
Configures the ValueGenerator that will generate values for this property. |
HasValueGenerator<TGenerator>() |
Configures the ValueGenerator that will generate values for this property. |
HasValueGenerator(Type)
Configures the ValueGenerator that will generate values for this property.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder HasValueGenerator (Type? valueGeneratorType);
abstract member HasValueGenerator : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder
override this.HasValueGenerator : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder
Public Overridable Function HasValueGenerator (valueGeneratorType As Type) As ComplexTypePrimitiveCollectionBuilder
Parameters
- valueGeneratorType
- Type
A type that inherits from ValueGenerator.
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 complex 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
HasValueGenerator<TGenerator>()
Configures the ValueGenerator that will generate values for this property.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder HasValueGenerator<TGenerator> () where TGenerator : Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator;
abstract member HasValueGenerator : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder (requires 'Generator :> Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator)
override this.HasValueGenerator : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePrimitiveCollectionBuilder (requires 'Generator :> Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator)
Public Overridable Function HasValueGenerator(Of TGenerator As ValueGenerator) () As ComplexTypePrimitiveCollectionBuilder
Type Parameters
- TGenerator
A type that inherits from ValueGenerator.
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 complex 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.
Applies to
Entity Framework
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort beschikbaar: In de loop van 2024 zullen we GitHub-problemen geleidelijk uitfaseren als het feedbackmechanisme voor inhoud en deze vervangen door een nieuw feedbacksysteem. Zie voor meer informatie:Feedback verzenden en weergeven voor