ValueGenerator<TValue> Class

Definition

Generates values for properties when an entity is added to a context.

public abstract class ValueGenerator<TValue> : Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator
type ValueGenerator<'Value> = class
    inherit ValueGenerator
Public MustInherit Class ValueGenerator(Of TValue)
Inherits ValueGenerator

Type Parameters

TValue
Inheritance
ValueGenerator<TValue>
Derived

Remarks

See EF Core value generation for more information and examples.

Constructors

ValueGenerator<TValue>()

Properties

GeneratesStableValues

Gets a value indicating whether the values generated are stable. That is, the value will always be the same for a given property in a given entity, and does not depend on what other values may have been generated previously. For example, discriminator values generated for a TPH hierarchy are stable. Stable values will never be marked as unknown.

(Inherited from ValueGenerator)
GeneratesTemporaryValues

Gets a value indicating whether the values generated are temporary (i.e they should be replaced by database generated values when the entity is saved) or are permanent (i.e. the generated values should be saved to the database).

(Inherited from ValueGenerator)

Methods

Next(EntityEntry)

Template method to be overridden by implementations to perform value generation.

NextAsync(EntityEntry, CancellationToken)

Template method to be overridden by implementations to perform value generation.

NextAsync(EntityEntry, CancellationToken)

Gets a value to be assigned to a property.

(Inherited from ValueGenerator)
NextValue(EntityEntry)

Gets a value to be assigned to a property.

NextValueAsync(EntityEntry, CancellationToken)

Gets a value to be assigned to a property.

NextValueAsync(EntityEntry, CancellationToken)

Template method to be overridden by implementations to perform value generation.

(Inherited from ValueGenerator)
WithConverter(ValueConverter)

Wraps this ValueGenerator such that it processes values converted with the given ValueConverter.

(Inherited from ValueGenerator)

Applies to