Equality in a domain model should be based in the Id only. The timestamp
changes on flush, but you are still referring to the same object.
Diego
On Thu, Aug 12, 2010 at 13:10, MattO <[email protected]> wrote:
> I'm curious as to what the proper way is to denote the signature for
> an object that has a timestamp value.
>
> Say I have the following table:
>
> Products {
> int productID; <--Primary Key
> string productName;
> byte[] timeStamp;
> }
>
> Would the domain signature / Gethashcode function only implement the
> hashcode on the productID, or in the case of this example should it
> always also include the timestamp value as well such that the
> GetHashCode comparison may look like this:
>
> public override int GetHashCode()
> {
> System.Text.StringBuilder sb = new
> System.Text.StringBuilder();
>
> sb.Append(this.GetType().FullName);
> sb.Append(productID);
> sb.Append(timeStamp);
>
> return sb.ToString().GetHashCode();
> }
>
> What is the correct way? If you searching for uniqueness in a domain
> object I would think you would always want to include the timestamp
> value, am I wrong in my interpretation?
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.