Table of Contents

Class SequenceBuilder

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Provides a simple API for configuring a ISequence.

public class SequenceBuilder : IInfrastructure<IConventionSequenceBuilder>
Inheritance
SequenceBuilder
Implements
Inherited Members

Remarks

See Database sequences for more information and examples.

Constructors

SequenceBuilder(IMutableSequence)

Creates a new builder for the given ISequence.

public SequenceBuilder(IMutableSequence sequence)

Parameters

sequence IMutableSequence

The IMutableSequence to configure.

Properties

Metadata

The sequence.

public virtual IMutableSequence Metadata { get; }

Property Value

IMutableSequence

Methods

HasAnnotation(string, object?)

Adds or updates an annotation on the sequence. If an annotation with the key specified in annotation already exists, its value will be updated.

public virtual SequenceBuilder HasAnnotation(string annotation, object? value)

Parameters

annotation string

The key of the annotation to be added or updated.

value object

The value to be stored in the annotation.

Returns

SequenceBuilder

The same builder instance so that multiple configuration calls can be chained.

HasMax(long)

Sets the maximum value for the ISequence.

public virtual SequenceBuilder HasMax(long maximum)

Parameters

maximum long

The maximum value for the sequence.

Returns

SequenceBuilder

The same builder so that multiple calls can be chained.

Remarks

See Database sequences for more information and examples.

HasMin(long)

Sets the minimum value for the ISequence.

public virtual SequenceBuilder HasMin(long minimum)

Parameters

minimum long

The minimum value for the sequence.

Returns

SequenceBuilder

The same builder so that multiple calls can be chained.

Remarks

See Database sequences for more information and examples.

IncrementsBy(int)

Sets the ISequence to increment by the given amount when generating each next value.

public virtual SequenceBuilder IncrementsBy(int increment)

Parameters

increment int

The amount to increment between values.

Returns

SequenceBuilder

The same builder so that multiple calls can be chained.

Remarks

See Database sequences for more information and examples.

IsCyclic(bool)

Sets whether or not the sequence will start again from the beginning once the maximum value is reached.

public virtual SequenceBuilder IsCyclic(bool cyclic = true)

Parameters

cyclic bool

If true, then the sequence will restart when the maximum is reached.

Returns

SequenceBuilder

The same builder so that multiple calls can be chained.

Remarks

See Database sequences for more information and examples.

StartsAt(long)

Sets the ISequence to start at the given value.

public virtual SequenceBuilder StartsAt(long startValue)

Parameters

startValue long

The starting value for the sequence.

Returns

SequenceBuilder

The same builder so that multiple calls can be chained.

Remarks

See Database sequences for more information and examples.