Funcular.IdGenerators.Base36.Base36IdGenerator.NewId C# (CSharp) Méthode

NewId() public méthode

Generates a unique, sequential, Base36 string. If this instance was instantiated using the default constructor, it will be 20 characters long. The first 11 characters are the microseconds elapsed since the InService DateTime (Epoch by default). The next 4 characters are the SHA1 of the hostname in Base36. The last 5 characters are random Base36 number between 0 and 36 ^ 5.
public NewId ( ) : string
Résultat string
        public string NewId()
        {
            return NewId(false);
        }

Same methods

Base36IdGenerator::NewId ( bool delimited ) : string

Usage Example

 /// <summary>
 /// This all would normally be done in your IoC container
 /// </summary>
 private static void Bootstrap()
 {
     var base36 = new Base36IdGenerator(
         numTimestampCharacters: 12, 
         numServerCharacters: 6, 
         numRandomCharacters: 7, 
         reservedValue: "", 
         delimiter: "-", 
         delimiterPositions: new[] { 20, 15, 10, 5 });
     var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
     _provider = new EntityFrameworkProvider(connectionString)
     {
         IsEntityType = type => type.IsSubclassOf(typeof(Createable<>))
     };
     _provider.SetCurrentUser("Funcular\\Paul");
     Createable<string>.IdentityFunction = () => base36.NewId();
 }