Microsoft.EntityFrameworkCore.ValueGeneration Namespace

Classes

BinaryValueGenerator

Generates an array bytes from NewGuid(). The generated values are non-temporary, meaning they will be saved to the database.

GuidValueGenerator

Generates Guid values using NewGuid(). The generated values are non-temporary, meaning they will be saved to the database.

HiLoValueGenerator<TValue>

Acts as a ValueGenerator by requesting a block of values from the underlying database and returning them one by one. Will ask the underlying database for another block when the current block is exhausted.

A block is represented by a low value fetched from the database, and then a block size that indicates how many sequential values can be used, starting from the low value, before a new low value must be fetched from the database.

HiLoValueGeneratorState

The thread safe state used by HiLoValueGenerator<TValue>.

RelationalValueGeneratorSelector

Selects value generators to be used to generate values for properties of entities.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

SequentialGuidValueGenerator

Generates sequential Guid values optimized for use in Microsoft SQL server clustered keys or indexes, yielding better performance than random values. This is the default generator for SQL Server Guid columns which are set to be generated on add.

See https://docs.microsoft.com/sql/t-sql/functions/newsequentialid-transact-sql. Although this generator achieves the same goals as SQL Server's NEWSEQUENTIALID, the algorithm used to generate the GUIDs is different.

The generated values are non-temporary, meaning they will be saved to the database.

StringValueGenerator

Generates String values using a string representation of NewGuid(). The generated values are non-temporary, meaning they will be saved to the database.

TemporaryGuidValueGenerator

Generates Guid values using NewGuid(). The generated values are temporary, meaning they will be replaced by database generated values when the entity is saved.

TemporaryNumberValueGeneratorFactory

Factory for creation of temporary integer value generators appropriate for the numeric type of the property.

Types supported are: Int32, Int64, Int16, Byte, Char, UInt64, UInt32, UInt16, SByte, Decimal, Single, Double

ValueGenerator

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

ValueGenerator<TValue>

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

ValueGeneratorCache

Keeps a cache of value generators for properties.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ValueGeneratorCacheDependencies

Service dependencies parameter class for ValueGeneratorCache

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Singleton. This means a single instance of each service is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

ValueGeneratorFactory

Base class for factories that create value generators.

ValueGeneratorSelector

Selects value generators to be used to generate values for properties of entities.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

ValueGeneratorSelectorDependencies

Service dependencies parameter class for ValueGeneratorSelector

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

Interfaces

IValueGeneratorCache

Keeps a cache of value generators for properties.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

IValueGeneratorSelector

Selects value generators to be used to generate values for properties of entities.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.