Ejemplo n.º 1
0
        public void SessionEx_Add()
        {
            RequestContext context = new RequestContext
            {
                Scope   = Scope,
                SqlId   = "Insert",
                Request = new T_Entity
                {
                    CreationTime   = DateTime.Now,
                    FString        = "SmartSql-" + Guid.NewGuid().ToString("N"),
                    FBool          = true,
                    FDecimal       = 1,
                    FLong          = 1,
                    FNullBool      = false,
                    FNullDecimal   = 1,
                    LastUpdateTime = null,
                    NullStatus     = EntityStatus.Ok,
                    Status         = EntityStatus.Ok
                }
            };

            context.Setup(_smartSqlContext);
            _sqlBuilder.BuildSql(context);
            var dbSession = _sessionStore.GetOrAddDbSession(DataSource);

            dbSession.Begin();
            for (int i = 0; i < 10; i++)
            {
                var result0 = _commandExecuter.ExecuteScalar(dbSession, context);
            }

            dbSession.End();
        }
Ejemplo n.º 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);
        }
        public void GetOrAddDbSession()
        {
            var dbSession = _sessionStore.GetOrAddDbSession(DataSource);

            Assert.NotNull(dbSession);
        }
Ejemplo n.º 4
0
 public DbConnectionSession_Test()
 {
     _sessionStore      = new DbConnectionSessionStore(LoggerFactory, DbProviderFactory);
     _connectionSession = _sessionStore.GetOrAddDbSession(DataSource);
 }