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