Dear All;

When I use the PreInsertEventListener saveorupdate throw AssertionFailure : 
null identiffier exception. 

I tried fallowing methods.

1- configuration.ExposeConfiguration(x => 
x.AppendListeners(ListenerType.PreInsert, new IPreInsertEventListener[] { 
ReplicationListener }))

2- configuration.ExposeConfiguration(x => 
x.EventListeners.PreInsertEventListeners = new IPreInsertEventListener[] { 
replicationEventListener })

3- configuration.ExposeConfiguration(x => 
x.SetListener(ListenerType.PreInsert, ReplicationListener ))

but problem is continued.

public class ReplicationEventListener : IPreInsertEventListener
    {
        public bool OnPreInsert(PreInsertEvent @event)
        {
            if (@event.Entity is IModel)
            {
               var guid = ((IModel)@event.Entity).SetRowUnique();
                Set(@event.Persister,@event.State,"RowGuid",guid);
            }
            return true;
        }

        private void Set(IEntityPersister persister, object[] state, string 
propertyName, object value)
        {
            var index = Array.IndexOf(persister.PropertyNames, 
propertyName);
            if (index == -1)
                return;
            state[index] = value;
        }
    }

all entities have this problem. All entities IdentityField is long type and 
have GeneratedBy.Identity() mapping.

Where is the problem? How can i solve this problem.

Best Regards.



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

Reply via email to