SequentialGuidValueGenerator Class

Definition

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.

public class SequentialGuidValueGenerator : Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator<Guid>
type SequentialGuidValueGenerator = class
    inherit ValueGenerator<Guid>
Public Class SequentialGuidValueGenerator
Inherits ValueGenerator(Of Guid)
Inheritance
SequentialGuidValueGenerator

Remarks

Although this generator achieves the same goals as SQL Server's NEWSEQUENTIALID, the algorithm used to generate the GUIDs is different. See NEWSEQUENTIALID for more information on the advantages of sequential GUIDs.

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

See EF Core value generation for more information and examples.

Constructors

SequentialGuidValueGenerator()

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 or permanent. This implementation always returns false, meaning the generated values will be saved to the database.

Methods

Next(EntityEntry)

Gets a value to be assigned to a property.

NextAsync(EntityEntry, CancellationToken)

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

(Inherited from ValueGenerator<TValue>)
NextValue(EntityEntry)

Gets a value to be assigned to a property.

(Inherited from ValueGenerator<TValue>)
NextValueAsync(EntityEntry, CancellationToken)

Gets a value to be assigned to a property.

(Inherited from ValueGenerator<TValue>)
WithConverter(ValueConverter)

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

(Inherited from ValueGenerator)

Applies to