public AllPrimitive GetById(long id) { using (var dbSession = _dbSessionFactory.Open()) { return(dbSession.GetById <AllPrimitive, long>(id)); } }
public void Insert() { using (var dbSession = _dbSessionFactory.Open()) { var data = dbSession.GetDataTable(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; bulkInsert.Insert(); } }
public IDbSession Open() { if (LocalSession == null) { _staticSession.Value = _dbSessionFactory.Open(); } return(LocalSession); }