Beispiel #1
0
        public async Task InsertByListAsync()
        {
            var list = await DbSession.QueryAsync <AllPrimitive>(new RequestContext
            {
                Scope   = nameof(AllPrimitive),
                SqlId   = "Query",
                Request = new { Taken = 100 }
            });

            IBulkInsert bulkInsert = new BulkInsert(DbSession);
            await bulkInsert.InsertAsync <AllPrimitive>(list);
        }
Beispiel #2
0
        public async Task InsertByListAsync()
        {
            using (var dbSession = _dbSessionFactory.Open())
            {
                var list = await dbSession.QueryAsync <AllPrimitive>(new RequestContext
                {
                    RealSql = "Select Top(100) * From T_AllPrimitive Order By Id Desc"
                });

                IBulkInsert bulkInsert = new BulkInsert(dbSession);
                await bulkInsert.InsertAsync <AllPrimitive>(list);
            }
        }
Beispiel #3
0
        public async Task InsertAsync()
        {
            using (var dbSession = _dbSessionFactory.Open())
            {
                var data = await dbSession.GetDataTableAsync(new RequestContext
                {
                    RealSql = "Select Top(100) * From T_AllPrimitive Order By Id Desc"
                });

                data.TableName = "T_AllPrimitive";
                IBulkInsert bulkInsert = new BulkInsert(dbSession);
                bulkInsert.Table = data;
                await bulkInsert.InsertAsync();
            }
        }
Beispiel #4
0
        public async Task InsertByListAsync()
        {
            using (var dbSession = SqlMapper.SessionStore.Open())
            {
                var list = await SqlMapper.QueryAsync <AllPrimitive>(new RequestContext
                {
                    Scope   = nameof(AllPrimitive),
                    SqlId   = "Query",
                    Request = new { Taken = 100 }
                });

                IBulkInsert bulkInsert = new BulkInsert(dbSession);
                await bulkInsert.InsertAsync <AllPrimitive>(list);
            }
        }
Beispiel #5
0
        public async Task InsertAsync()
        {
            var data = await DbSession.GetDataTableAsync(new RequestContext
            {
                Scope   = nameof(AllPrimitive),
                SqlId   = "Query",
                Request = new { Taken = 100 }
            });

            data.TableName = "T_AllPrimitive";
            IBulkInsert bulkInsert = new BulkInsert(DbSession);

            bulkInsert.Table = data;
            await bulkInsert.InsertAsync();
        }
Beispiel #6
0
        public async Task InsertAsync()
        {
            using (var dbSession = SqlMapper.SessionStore.Open())
            {
                var data = await SqlMapper.GetDataTableAsync(new RequestContext
                {
                    Scope   = nameof(AllPrimitive),
                    SqlId   = "Query",
                    Request = new { Taken = 100 }
                });

                data.TableName = "T_AllPrimitive";
                IBulkInsert bulkInsert = new BulkInsert(dbSession);
                bulkInsert.Table = data;
                await bulkInsert.InsertAsync();
            }
        }