fluent-nhibernate
fluent-nhibernate copied to clipboard
Modify Entity.Equals to Return False When Both IDs are Zero
May I request that the method Equals on the class FluentNHibernate.Data.Entity return false when both have 0 ids, since that indicates they have not been created yet, and are not equal?
The main reason I would like this is because of when intializing a class which has a hashset property:
class ChildEntity: Entity { }
class ParentEntity: Entity
{
public ICollection<ChildEntity> MyProperty { get; set; } = new HashSet<ChildEntity>();
}
...
// Will have only one child.
var myVariable = new ParentEntity
{
MyProperty = { new ChildEntity(), new ChildEntity() }
}
The function which would be modified can be found here.
No biggy if it shouldn't be the case though, as it's virtual. But would be nice if an additional class didn't have to be added over-top of it.