private static void PostCreateEventHandler(object src, PostCreateEventArgs evnt) { Assert.That(((IResultMap)src).Id, Is.EqualTo("Account.account-result-constructor")); Account account = (Account)evnt.Instance; account.Id = 1234; account.FirstName = "New FirstName"; account.LastName = "New LastName"; }
/// <summary> /// Raises the <see cref="PostCreateEventArgs"/>. /// </summary> /// <param name="instance">The instance.</param> /// <returns> /// Returns is used as the parameters used to create the object /// </returns> protected object RaisePostCreateEvent(object instance) { EventHandler <PostCreateEventArgs> handlers = (EventHandler <PostCreateEventArgs>)events[PostCreateEvent]; if (handlers != null) { PostCreateEventArgs eventArgs = new PostCreateEventArgs(); eventArgs.Instance = instance; handlers(this, eventArgs); return(eventArgs.Instance); } return(instance); }
/// <summary> /// Raises the <see cref="PostCreateEventArgs"/>. /// </summary> /// <param name="instance">The instance.</param> /// <returns> /// Returns is used as the parameters used to create the object /// </returns> protected object RaisePostCreateEvent(object instance) { EventHandler<PostCreateEventArgs> handlers = (EventHandler<PostCreateEventArgs>)events[PostCreateEvent]; if (handlers != null) { PostCreateEventArgs eventArgs = new PostCreateEventArgs(); eventArgs.Instance = instance; handlers(this, eventArgs); return eventArgs.Instance; } return instance; }