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
-
IInfrastructure<IConventionSequenceBuilder>
- 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
IMutableSequenceThe IMutableSequence to configure.
Properties
Metadata
The sequence.
public virtual IMutableSequence Metadata { get; }
Property Value
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
stringThe key of the annotation to be added or updated.
value
objectThe 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
longThe 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
longThe 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
intThe 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
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
longThe 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.