Exemple #1
0
        public SqlParamObjForeachPolicyExecutorBase(ISqlParamConverter sqlParamCvt, IObjectReflector objReflec, IEFCoreExtendUtility util)
        {
            sqlParamCvt.CheckNull(nameof(sqlParamCvt));
            objReflec.CheckNull(nameof(objReflec));
            util.CheckNull(nameof(util));

            _sqlParamCvt = sqlParamCvt;
            _objReflec   = objReflec;
            _util        = util;
        }
        public SqlConfigExecutorCreator(ISqlExecutor sqlExecutor,
                                        ISqlParamConverter sqlParamCvt, IEFCoreExtendUtility util)
        {
            sqlExecutor.CheckNull(nameof(sqlExecutor));
            sqlParamCvt.CheckNull(nameof(sqlParamCvt));
            util.CheckNull(nameof(util));

            _sqlExecutor = sqlExecutor;
            _sqlParamCvt = sqlParamCvt;
            _util        = util;
        }
 /// <summary>
 /// 将sql的参数模型对象 转换成 sql的参数
 /// </summary>
 /// <param name="db"></param>
 /// <param name="paramsModel">sql的参数模型对象</param>
 /// <param name="ignoreProptNames">sql的参数模型对象中需要忽略的属性名</param>
 /// <returns></returns>
 public static IDataParameter[] ObjectToDBParams(this ISqlParamConverter sqlParamCvt, DbContext db,
                                                 object paramsModel, IEnumerable <string> ignoreProptNames = null)
 {
     if (paramsModel != null)
     {
         return(sqlParamCvt.DictionaryToDBParams(db,
                                                 EFHelper.Services.ObjReflector.GetPublicInstanceProptValues(paramsModel, ignoreProptNames)));
     }
     else
     {
         return(new IDataParameter[0]);
     }
 }
Exemple #4
0
        public SqlConfigExecutor(ISqlConfigManager sqlConfigMgr, DbContext db,
                                 string tableName, string sqlName, IConfigSqlInfo sqlInfo, IConfigTableInfo tableInfo, string sql,
                                 ISqlExecutor sqlExecutor, ISqlParamConverter sqlParamCvt, IEFCoreExtendUtility util)
        {
            _sqlConfigMgr = sqlConfigMgr;
            _db           = db;
            _sqlInfo      = sqlInfo;
            _tableName    = tableName;
            _sqlName      = sqlName;
            _tableInfo    = tableInfo;
            _sql          = sql;

            _sqlExecutor = sqlExecutor;
            _sqlParamCvt = sqlParamCvt;
            _util        = util;
        }
        public LuaSqlConfigManager(IEFQueryCache efcache, ISqlExecutor sqlExecutor,
                                   ISqlParamConverter sqlParamConverter, ILuaSqlPolicyManager policyExecutorMgr,
                                   IObjectReflector objReflec, IEFCoreExtendUtility util, ILuaFuncManager luafuncs, ILuaSqlConfig config)
            : base(sqlExecutor, sqlParamConverter, policyExecutorMgr, util, config)
        {
            objReflec.CheckNull(nameof(objReflec));
            efcache.CheckNull(nameof(efcache));
            luafuncs.CheckNull(nameof(luafuncs));

            _luafuncs  = luafuncs;
            _efcache   = efcache;
            _objReflec = objReflec;

            //添加默认的策略
            AddDefaultPolicies();
        }
Exemple #6
0
        public LuaSqlConfigExecutor(ILuaSqlConfigManager sqlConfigMgr, DbContext db,
                                    IDictionary <string, IDictionary <string, object> > luaSqlParamFuncContainer,
                                    string tableName, string sqlName, ILuaConfigSqlInfo sqlInfo, ILuaConfigTableInfo tableInfo,
                                    ISqlExecutor sqlExecutor, ISqlParamConverter sqlParamCvt, IEFCoreExtendUtility util)
        {
            _luaSqlParamFuncContainer = luaSqlParamFuncContainer;
            _sqlConfigMgr             = sqlConfigMgr;
            _db        = db;
            _sqlInfo   = sqlInfo;
            _tableInfo = tableInfo;
            _tableName = tableName;
            _sqlName   = sqlName;

            _sqlExecutor = sqlExecutor;
            _sqlParamCvt = sqlParamCvt;
            _util        = util;
        }
        public LuaSqlConfigManagerBase(
            ISqlExecutor sqlExecutor,
            ISqlParamConverter sqlParamConverter, ILuaSqlPolicyManager policyExecutorMgr,
            IEFCoreExtendUtility util, ILuaSqlConfig config)
        {
            sqlExecutor.CheckNull(nameof(sqlExecutor));
            sqlParamConverter.CheckNull(nameof(sqlParamConverter));
            policyExecutorMgr.CheckNull(nameof(policyExecutorMgr));
            util.CheckNull(nameof(util));
            config.CheckNull(nameof(config));

            _sqlParamConverter = sqlParamConverter;
            _policyMgr         = policyExecutorMgr;
            _util        = util;
            _sqlExecutor = sqlExecutor;

            _config             = config;
            _config.OnModified += OnModified;

            _init = new InitAction(DoInit);
        }
        public SqlConfigManagerBase(ISqlConfigExecutorCreator sqlConfigExecutorCreator, IEFQueryCache efcache,
                                    ISqlParamConverter sqlParamConverter, ISqlPolicyManager policyExecutorMgr,
                                    IObjectReflector objReflec, IEFCoreExtendUtility util)
        {
            sqlConfigExecutorCreator.CheckNull(nameof(sqlConfigExecutorCreator));
            efcache.CheckNull(nameof(efcache));
            sqlParamConverter.CheckNull(nameof(sqlParamConverter));
            policyExecutorMgr.CheckNull(nameof(policyExecutorMgr));
            objReflec.CheckNull(nameof(objReflec));
            util.CheckNull(nameof(util));

            _sqlParamConverter        = sqlParamConverter;
            _efcache                  = efcache;
            _sqlConfigExecutorCreator = sqlConfigExecutorCreator;
            _policyMgr                = policyExecutorMgr;
            _objReflec                = objReflec;
            _util = util;

            _config = new SqlConfig(OnModified);
            _init   = new InitAction(DoInit);

            //添加默认的策略
            AddDefaultPolicies();
        }
Exemple #9
0
 public SqlForeachParamsPolicyExecutor(ISqlParamConverter sqlParamCvt, IObjectReflector objReflec, IEFCoreExtendUtility util)
     : base(sqlParamCvt, objReflec, util)
 {
 }
 /// <summary>
 /// 将Dictionary => IDataParameter[] ( SqlParameters)
 /// </summary>
 /// <param name="sqlParamCvt"></param>
 /// <param name="db"></param>
 /// <param name="dictParams"></param>
 /// <returns></returns>
 public static IDataParameter[] DictionaryToDBParamsR(this ISqlParamConverter sqlParamCvt, DbContext db,
                                                      IReadOnlyDictionary <string, object> dictParams)
 {
     return(sqlParamCvt.DictionaryToDBParams(db, dictParams, dictParams?.Count));
 }
Exemple #11
0
 public SqlConfigManager(ISqlConfigExecutorCreator sqlConfigExecutorCreator, IEFQueryCache efcache,
                         ISqlParamConverter sqlParamConverter, ISqlPolicyManager policyExecutorMgr,
                         IObjectReflector objReflec, IEFCoreExtendUtility util)
     : base(sqlConfigExecutorCreator, efcache, sqlParamConverter, policyExecutorMgr, objReflec, util)
 {
 }