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); }
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); } }
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(); } }
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); } }
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(); }
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(); } }