I have a problem when the 'object[]' for currentState and previousState in
my interceptor on the:
public override bool OnFlushDirty(object entity, object id, object[]
currentState, object[] previousState, string[] propertyNames, IType[] types)
have the same values for a list that has changed in the transaction. For
example:
public class Entity{
public long Id { get; set; }
public IList<OtherEntity> Others { get; set; }}
If I where to have on the entity class property others a list of 3 objects
and I removed one. I would expect in the OnFlushDirty to have previousState to
contain the object entity but to have its Others property with a count of 3
and in the currentState to have a count of 2. But both have a count of two.
The OtherEntity is also a Many-to-Many relationship which is setup in
NHibernate as such:
mapper.Class<Entity>(map => map.IdBag("Others",
cm =>
{
cm.Id(id =>
{
id.Column("Id");
id.Generator(Generators.GuidComb);
});
cm.Cascade(Cascade.Persist);
cm.Table("Lnk_Entity_Others");
cm.Lazy(lazy ? CollectionLazy.Lazy : CollectionLazy.NoLazy);
cm.Key(km =>
{
km.Column(c =>
{
c.Name("EntityId");
c.Index(String.Format("IX_{0}_{1}",
"Lnk_Entity_Others", "EntityId"));
});
km.Unique(true);
});
},
em => em.ManyToMany(m => m.Column(c =>
{
c.Name("OtherEntityId");
c.Index(String.Format("IX_{0}_{1}", "Lnk_Entity_Others", "OtherEntityId"));
}))));
How can I get this to work as I originally expected it to? Have I setup
something incorrectly in the Many-to-Many mapping or is NHibernate working
as expected?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.