Пример #1
0
        private T ExecuteWarp <T>(Func <IDbCommand, T> excute, IDbConnectionSession dbSession, RequestContext context)
        {
            var dbCommand = _preparedCommand.Prepare(dbSession, context);

            dbSession.OpenConnection();
            T result = excute(dbCommand);

            OnExecuted?.Invoke(this, new OnExecutedEventArgs
            {
                DbSession      = dbSession,
                RequestContext = context
            });
            return(result);
        }
Пример #2
0
        public void Prepare()
        {
            RequestContext context = new RequestContext
            {
                Scope   = Scope,
                SqlId   = "Query",
                Request = new { Id = 1, UserName = "******", Ids = new long[] { 1, 2, 3, 4 } }
            };

            context.Setup(_smartSqlOptions);
            var dbSession = _sessionStore.GetOrAddDbSession(DataSource);
            var dbCommand = _preparedCommand.Prepare(dbSession, context);

            Assert.NotNull(dbCommand);
        }