public object ExecuteScalar(EumDBName dBName, string commandText, object paramEntity) { using (IDbConnection Connection = IoC.Resolve <IMapper>().GetConnection(DataBaseHelper.GetConnectionStrings(EumDBWay.Writer, dBName.GetDisplayName()))) { return(Connection.ExecuteScalar(commandText, paramEntity)); } }
public UnitOfWorkResult ExecuteCommand <T>(EumDBWay dbWay, EumDBName dbName, string commandText, CommandType commandType, params DataParameterInfo[] parameters) where T : BaseInfo { return(RegisterExecuteUnitOfWork(dbWay, dbName.GetDisplayName(), typeof(T).FullName, commandText, commandType, parameters)); }
public IList <T> GetPageInfos <T>(EumDBName dBName, string sql, string order, int pageIndex, int pageSize, object parameter = null) { Type type = typeof(T); using (IDbConnection Connection = IoC.Resolve <IMapper>().GetConnection(DataBaseHelper.GetConnectionStrings(EumDBWay.Reader, dBName.GetDisplayName(), typeof(T).FullName))) { var sqlstr = sql.ToString() + " order by " + order; var queryPage = $"{sqlstr} offset {(pageIndex - 1) * pageSize} row fetch next {pageSize} rows only"; return(Connection.Query <T>(queryPage.ToString(), parameter).ToList()); } }
public int GetPageCount <T>(EumDBName dBName, string tables, string filter, object parameter = null) { Type type = typeof(T); TableAttribute dbAtt = type.GetCustomAttribute(typeof(TableAttribute)) as TableAttribute; using (IDbConnection Connection = IoC.Resolve <IMapper>().GetConnection(DataBaseHelper.GetConnectionStrings(EumDBWay.Reader, dBName.GetDisplayName(), typeof(T).FullName))) { string str = IoC.Resolve <IMapper>().GetPageCountByMultilist(tables, filter); return(Connection.Query <int>(IoC.Resolve <IMapper>().GetPageCountByMultilist(tables, filter), parameter).FirstOrDefault()); } }
public IList <T> GetInfos <T>(EumDBName dBName, string query, object parameter) { Type type = typeof(T); using (IDbConnection Connection = IoC.Resolve <IMapper>().GetConnection(DataBaseHelper.GetConnectionStrings(EumDBWay.Reader, dBName.GetDisplayName(), typeof(T).FullName))) { IEnumerable <T> infos = Connection.Query <T>(query, parameter); return(infos.ToList()); } }