Exemple #1
0
        /// <summary>
        /// 从数据库取出
        /// </summary>
        /// <returns></returns>
        private static List <ExtendFuncBizModel> LoadExtendConfigureFromDataSource(ISession session)
        {
            List <ExtendFuncBizModel> configures = new List <ExtendFuncBizModel>();


            var criteria = session.CreateCriteria <ExtendFunctionMstModel>();
            var mstData  = criteria.List <ExtendFunctionMstModel>();

            foreach (var item in mstData)
            {
                //从SQL中取数,先模拟
                ExtendFuncBizModel entity = new ExtendFuncBizModel();
                long phid = item.Phid;

                var sqldatas = session.CreateQuery("from AddinSqlModel s where s.MstPhid=" + phid + " and SqlCatalog=" + (int)EnumCatalog.Extend).List <AddinSqlModel>();

                var assemblydatas = session.CreateQuery("from AddinAssemblyModel a where a.MstPhid=" + phid + " and AssemblyCatalog=" + (int)EnumCatalog.Extend).List <AddinAssemblyModel>();

                entity.AssemblyModels = assemblydatas;
                entity.SqlModels      = sqldatas;
                entity.MstModel       = item;

                configures.Add(entity);
            }
            //直接从数据库获取

            return(configures);
        }
Exemple #2
0
        public static IExtendAction GetExtendAction(ISession session, string name)
        {
            ExtendFuncBizModel entity = ExtendConfigure.GetConfigureEntity(name);

            //找不到对应的配置则返回空
            if (entity == null)
            {
                return(null);
            }

            EnumAddinType type = entity.MstModel.FuncType;

            IExtendAction executor = null;

            if (type == EnumAddinType.Url)
            {
                executor = new ExtendUrlAction();
            }
            else if (type == EnumAddinType.Sql)
            {
                executor = new ExtendSqlAction();
            }
            else if (type == EnumAddinType.Assembly)
            {
                executor = new ExtendAssemblyAction();
            }
            //注入参数
            if (executor != null)
            {
                executor.Session         = session;
                executor.ConfigureEntity = entity;
            }

            return(executor);
        }
Exemple #3
0
 public static bool AddExtendFunc(string key, ExtendFuncBizModel model)
 {
     return(_extendFuncCache.TryAdd(key, model));
 }