NHibernate - NHibernate recognizes object equality, and is change preserving behavior accordingly?

Let's say you have two classes: Person and Address.

The person has a link to Address as follows:

public class Person
{
  public virtual Address Residence {get;set;}
}

The address has an override of .Equals, which determines whether two instances of the address represent the same physical address (for example, by comparing the zip code and the first line).

Let's say you have two unsaved Person objects that contain references to two unsaved Address objects that are separate (in terms of reference equality) but equal in terms of .Equals implementation.

Will NHibernate issue one INSERT or two?

thank

David

+3
source share
1

. .

.

+2

Source: https://habr.com/ru/post/1755010/


All Articles