示例#1
0
        private static void PostSelectEventHandler(object src, PostStatementEventArgs evnt)
        {
            Assert.That(((IMappedStatement)src).Id, Is.EqualTo("SelectAccount"));
            Account account = (Account)evnt.ResultObject;

            account.Id = 99;
        }
示例#2
0
        private static void PostUpdateOrDeleteEventHandler(object src, PostStatementEventArgs evnt)
        {
            Assert.That(((IMappedStatement)src).Id, Is.EqualTo("UpdateAccount"));
            Account account = (Account)evnt.ParameterObject;

            account.Id        = 99;
            evnt.ResultObject = 999;
        }
示例#3
0
        /// <summary>
        /// Raises the post event.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="parameterObject">The parameter object.</param>
        /// <param name="resultObject">The result object.</param>
        /// <param name="cacheHit">Did the ResultObject come from cache?</param>
        /// <returns>Returns is used as the result object</returns>
        protected TType RaisePostEvent <TType>(object key, object parameterObject, TType resultObject, bool cacheHit)
        {
            var handlers = (EventHandler <PostStatementEventArgs>)events[key];

            if (handlers != null)
            {
                var eventArgs = new PostStatementEventArgs();
                eventArgs.ParameterObject = parameterObject;
                eventArgs.ResultObject    = resultObject;
                eventArgs.CacheHit        = cacheHit;
                handlers(this, eventArgs);
                return((TType)eventArgs.ResultObject);
            }
            return(resultObject);
        }