public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
        {
            //// dit werkt dus niet....
            //return;
            if (@event.AffectedOwnerOrNull == null || @event.AffectedOwnerOrNull is ISearchable == false)
                return;

            using (var session = sessionFactory.OpenSession())
            {
                session.FlushMode = FlushMode.Never;
                var entity = session.Get(@event.AffectedOwnerOrNull.GetType(), ((ISearchable) @event.AffectedOwnerOrNull).Id);
                Indexer.WriteChangesToLucene((ISearchable)entity);
            }
        }
		private void PostUpdate()
		{
			IPostCollectionUpdateEventListener[] postListeners = Session.Listeners.PostCollectionUpdateEventListeners;
			if (postListeners.Length > 0)
			{
				PostCollectionUpdateEvent postEvent = new PostCollectionUpdateEvent(Persister, Collection, (IEventSource)Session);
				for (int i = 0; i < postListeners.Length; i++)
				{
					postListeners[i].OnPostUpdateCollection(postEvent);
				}
			}
		}
 public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
 {
     ProcessCollectionEvent(@event);
 }
Beispiel #4
0
 public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
 {
     Debug.WriteLine("EventListener.OnPostUpdateCollection: {0} {1}", @event.AffectedOwnerIdOrNull, @event.Collection.Role);
 }
			public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
			{
				AddEvent(@event, this);
			}
 public void OnPostUpdateCollection(PostCollectionUpdateEvent ev)
 {
     DispatchEvents(ev.AffectedOwnerOrNull as AggregateRoot);
 }
        public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
        {
            if (@event.AffectedOwnerOrNull is Audit)
            {
                return;
            }

            if (@event.AffectedOwnerOrNull is IAuditable)
            {

                var auditableEntity = @event.AffectedOwnerOrNull as IAuditable;
                var entityId = auditableEntity.IdForAuditing;
                var entityFullName = @event.AffectedOwnerOrNull.GetType().FullName;

                var fieldName = GetItemTypeFromGenericType(@event.Collection.GetType()).Name;
                
                if (auditableEntity.LastModifiedBy == null)
                {
                    throw new AuditUpdateLastModifiedByNotSetExceptions(entityFullName, entityId);
                }

                var collectionItems = @event.Collection as IEnumerable;
                var now = DateTime.Now;
                var updateId = Guid.NewGuid();

                foreach (var item in collectionItems)
                {
                    if (item.GetType() == typeof(IAuditable))
                    {
                        var w = item as IAuditable;

                        AddRecord(
                            "U",
                            entityFullName,
                            entityId,
                            fieldName + " Collection",
                            "",
                            w.IdForAuditing,
                            now,
                            auditableEntity.LastModifiedBy.Id.ToString(),
                            updateId);
                    }
                  
                }
            }
        }
 public void OnPostUpdateCollection(PostCollectionUpdateEvent @event)
 {
     log.Debug("OnPostUpdateCollection :" + @event);
 }