Table of Contents

Class SequentialGuidValueGenerator

Namespace
Microsoft.EntityFrameworkCore.ValueGeneration
Assembly
Microsoft.EntityFrameworkCore.dll

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 : ValueGenerator<Guid>
Inheritance
SequentialGuidValueGenerator
Inherited Members

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()

public SequentialGuidValueGenerator()

Properties

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.

public override bool GeneratesTemporaryValues { get; }

Property Value

bool

Methods

Next(EntityEntry)

Gets a value to be assigned to a property.

public override Guid Next(EntityEntry entry)

Parameters

entry EntityEntry

The change tracking entry of the entity for which the value is being generated.

Returns

Guid

The value to be assigned to a property.