예제 #1
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);
        }
예제 #2
0
 public static bool IsValid(EntityGuidId <TAggregateRootId> entityId)
 {
     return((!ReferenceEquals(null, entityId)) && entityId.Id != default(Guid));
 }