http://ayende.com/Blog/archive/2007/06/05/Generic-Entity-Equality.aspx

On Mon, Dec 15, 2008 at 11:32 PM, Tim Barcz <[email protected]> wrote:

> I am reading through a book on NHibernate (NHIbernate in Action, Manning)
> and when talking about comparing entity values based on database identifier
> (which is what EntityBase does) it strongly discourages equality based on
> database Id's:
>
> Unfortunately, this solution has one huge problem: NHibernate doesn't
>> assign identifier values until an
>> entity is saved. So, if the object is added to an ISet before being saved,
>> its hash code changes while it's
>> contained by the ISet, contrary to the contract defined by this
>> collection. In particular, this problem makes
>> cascade save (discussed later in this chapter) useless for sets. We
>> strongly discourage this solution (database
>> identifier equality).
>
>
> Generally DDD looks at an Entity's unique ID for determining equality.
> However I'm a bit concerned at the strong warning from the NHibernate camp
> about this type of equality comparison.
>
> What's the thought on this?  I'd be interested in hearing arguments on
> either side.
>
> Tim
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to