Ejemplo n.º 1
0
        public GuidHashMap Add(Guid id, DateTime?createAt = null)
        {
            var guidHash = GuidHash.CreateGuidHash(id, createAt);

            Items.Add(guidHash.Hash, guidHash);
            return(this);
        }
Ejemplo n.º 2
0
        public static GuidHash CreateGuidHash(Guid id, DateTime?createAt = null)
        {
            //N   32 digits:
            //00000000000000000000000000000000
            //D   32 digits separated by hyphens:
            //00000000 - 0000 - 0000 - 0000 - 000000000000
            //B   32 digits separated by hyphens, enclosed in braces:
            //{ 00000000 - 0000 - 0000 - 0000 - 000000000000}
            //P   32 digits separated by hyphens, enclosed in parentheses:
            //(00000000 - 0000 - 0000 - 0000 - 000000000000)
            //X Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces:
            //{ 0x00000000,0x0000,0x0000,{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }
            var guidHash = new GuidHash();

            guidHash.Id   = id;
            guidHash.Hash = id.ToString("N").GetHashSha1();
            if (createAt != null)
            {
                guidHash.CreateAt = createAt.Value;
            }
            return(guidHash);
        }