示例#1
0
 private void setBaseSql <T>()
 {
     if (this.baseSql == null)
     {
         DapperDbHelperMapper dapperDbHelperMapper = new DapperDbHelperMapper(_cache);
         if (_cache != null)
         {
             this.baseSql = dapperDbHelperMapper.GetDapperBaseSQLAtCache <T>();
         }
         else
         {
             this.baseSql = dapperDbHelperMapper.GetDapperBaseSQL(typeof(T));
         }
     }
 }
示例#2
0
        public DapperBaseSQL GetDapperBaseSQL(Type type)
        {
            DapperSqlHelper dapperSql     = new DapperSqlHelper();
            DataTableConfig config        = new DataTableConfig(type);
            DapperBaseSQL   dapperBaseSQL = new DapperBaseSQL
            {
                Get         = dapperSql.GetDarpperModelSql(config),
                GetList     = dapperSql.GetDarpperModelListSql(config) + " where 1=1",
                Insert      = dapperSql.GetDarpperInsertSql(config),
                Update      = dapperSql.GetDarpperUpdateSql(config),
                Delete      = dapperSql.GetDarpperDeleteSql(config),
                TableConifg = config
            };

            return(dapperBaseSQL);
        }
示例#3
0
 public void RegisterType(Type type)
 {
     _cache.Set <bool>(GetRegionLable(type), true);
     if (type.IsClass)
     {
         if (TableAttrbuteHelper.GetTableName(type) == null)
         {
             return;
         }
         string        key           = GetKeyID(type);
         DapperBaseSQL baseSql       = _cache.Get <DapperBaseSQL>(key);
         DapperBaseSQL dapperBaseSQL = GetDapperBaseSQL(type);
         if (baseSql != null)
         {
             baseSql = dapperBaseSQL;
         }
         else
         {
             _cache.Set <DapperBaseSQL>(key, dapperBaseSQL);
         }
     }
 }