Example #1
0
 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));
     }
 }
Example #2
0
 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));
 }
Example #3
0
        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());
            }
        }
Example #4
0
        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());
            }
        }
Example #5
0
        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());
            }
        }