Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(HashCodeModifier.AggregateRootId ^ ByteArrayHelper.ComputeHash(RawId));
     }
 }
Esempio n. 2
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));
 }
Esempio n. 3
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());
 }
Esempio n. 4
0
 public virtual bool Equals(IAggregateRootId other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(ByteArrayHelper.Compare(RawId, other.RawId));
 }
Esempio n. 5
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);
        }