Note that there are some explanatory texts on larger screens.

plurals
  1. POAbstract Base class for All Domain Entity Objects
    text
    copied!<p>I am seeing in some domain object models that an abstract base class is created(that implement Equals and GetHashCode) for all domain Entity objects to inherit from to gain their identity.</p> <p>I am not clear why this base class is needed and when and why it should be used. Can you provide me some insight on this or refer me a link that talks on this</p> <p>Thanks</p> <p>Now I understand the advantages of overriding Equality (this link helped <a href="http://en.csharp-online.net/CSharp_Canonical_Forms" rel="nofollow noreferrer">http://en.csharp-online.net/CSharp_Canonical_Forms</a>—Identity_Equality)</p> <p>Going back to domain driven design I would like to expand my question a bit;</p> <p>I have a customer entity which I use guid as identity.</p> <p>If I create 2 instances of customer with exactly the same details, since I am using guid as the identity they will be two different objects. But as they have all attributes the same they should be the same object(or is it a better ddd practice to keep them unique and seperate??)</p> <p>Trying to understand if I should handle the equality of two objects by their full attribute value match. If I go toward that direction then I am looking at either overriding the Equality of the base class on the level of sub class and implement these conditions or have the identity of the entity a string or hash code(?) representation of the values of all these attributes and use the Equality of the base class.</p> <p>I could be little off here so thanks in advance for the patience.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload