示例#1
0
 public StringId(StringId idBase, string aggregateRootName) : base(aggregateRootName)
 {
     if (!IsValid(idBase))
     {
         throw new ArgumentException("Empty string value is not allowed.", "idBase");
     }
     Id         = idBase.Id;
     base.RawId = ByteArrayHelper.Combine(UTF8Encoding.UTF8.GetBytes(AggregateRootName + "@"), UTF8Encoding.UTF8.GetBytes(Id));
 }
示例#2
0
 public GuidId(GuidId idBase, string aggregateRootName) : base(aggregateRootName)
 {
     if (!IsValid(idBase))
     {
         throw new ArgumentException("Default guid value is not allowed.", "idBase");
     }
     Id         = idBase.Id;
     base.RawId = ByteArrayHelper.Combine(UTF8Encoding.UTF8.GetBytes(AggregateRootName + "@"), Id.ToByteArray());
 }
示例#3
0
        public EntityGuidId(EntityGuidId <TAggregateRootId> idBase, string entityId)
            : base(idBase.RootId, entityId)
        {
            if (!IsValid(idBase))
            {
                throw new ArgumentException("Default guid value is not allowed.", "idBase");
            }
            Id = idBase.Id;
            var entityBytes = ByteArrayHelper.Combine(UTF8Encoding.UTF8.GetBytes(EntityName + "@"), Id.ToByteArray());
            var rootBytes   = ByteArrayHelper.Combine(UTF8Encoding.UTF8.GetBytes("@@"), RootId.RawId);

            base.RawId = ByteArrayHelper.Combine(entityBytes, rootBytes);
        }