Class DefaultIdGenerator
The default implementation of an identifier generator.
Inheritance
System.Object
DefaultIdGenerator
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Data
Assembly: Kephas.Core.dll
Syntax
[OverridePriority(Priority.Low)]
public class DefaultIdGenerator : IIdGenerator
Constructors
| Improve this Doc View SourceDefaultIdGenerator(IConfiguration<IdGeneratorSettings>)
Initializes a new instance of the DefaultIdGenerator class.
Declaration
public DefaultIdGenerator(IConfiguration<IdGeneratorSettings> configuration)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration<IdGeneratorSettings> | configuration | The configuration. |
Methods
| Improve this Doc View SourceGenerateDiscriminator(ref Int64)
Generates the discriminator part for the relative timestamp.
Declaration
protected int GenerateDiscriminator(ref long relativeTimestamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | relativeTimestamp | The relative timestamp. |
Returns
Type | Description |
---|---|
System.Int32 | The discriminator part of the ID. |
Remarks
The relative timestamp may be adjusted to avoid collisions.
GenerateId()
Generates the 52-bit identifier. This is due to the fact that JavaScript can read accurately only integers up to 2^53, values greater than that will get truncated. See http://stackoverflow.com/questions/5353388/javascript-parsing-int64 for more info.
Declaration
public long GenerateId()
Returns
Type | Description |
---|---|
System.Int64 | The unique identifier. |