Example #1
0
 static IdBuilder()
 {
     _dic[typeof(IdBuilder)] = new IdBuilderRule()
     {
         prefix     = "",
         FCount     = 4,
         DateFormat = "yyyyMMddHHmmssffff"
     };
 }
Example #2
0
 public static void Register(Type type, string prefix, int fCount, string timeFormat)
 {
     _dic[type] = new IdBuilderRule()
     {
         prefix     = prefix,
         FCount     = fCount,
         DateFormat = timeFormat
     };
 }
Example #3
0
        public static string NextStringId(Type type)
        {
            IdBuilderRule rule = null;

            if (!_dic.ContainsKey(type))
            {
                rule = _dic[typeof(IdBuilder)];
            }
            else
            {
                rule = _dic[type];
            }

            //long idTick = rule.Next();
            //var now = new DateTime(idTick);

            return(rule.prefix + ObjectIdGenerator.NextId());
        }
Example #4
0
 public static void Register(Type type, IdBuilderRule rule)
 {
     _dic[type] = rule;
 }