コード例 #1
0
        /// <summary>
        /// CMS初始化
        /// </summary>
        public static void Init()
        {
            //设置依赖反转
            ObjectFactory.Configure(x =>
            {
                //x.For<IArchiveModel>().Singleton().Use<ArchiveBLL>();
                // x.For<ICategoryModel>().Singleton().Use<CategoryBLL>();
                x.For <IComment>().Singleton().Use <CommentBLL>();
                // x.For<ILink>().Singleton().Use<LinkBLL>();
                x.For <Imember>().Singleton().Use <MemberBLL>();
                x.For <Imessage>().Singleton().Use <MessageBLL>();
                x.For <Imodule>().Singleton().Use <ModuleBLL>();
                //x.For<ISite>().Singleton().Use<SiteBLL>();
                // x.For<ITemplateBind>().Singleton().Use<TemplateBindBLL>();
                x.For <IUser>().Singleton().Use <UserBLL>();
                x.For <ITable>().Singleton().Use <TableBLL>();
            });

            //读取站点
            Cms.RegSites(SiteCacheManager.GetAllSites().ToArray());

            //内嵌资源释放
            SiteResourceInit.Init();

            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);

            Cms.Utility.SetDirHidden("config");
            Cms.Utility.SetDirHidden("bin");
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        public static void UserCmsInitializer(this IApplicationBuilder app)
        {
            app.UseCmsMiddleware(); // 添加cms拦截器
            // app.UseCmsRoutes();          // 注册路由

            //Cms.OnInit += CmsEventRegister.Init;
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new MemoryCacheWrapper());
            Cms.Init(BootFlag.Normal, null);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();


            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");

            //注册定时任务
            //CmsTask.Init();
        }
コード例 #3
0
ファイル: AspNetCmsInitializer.cs プロジェクト: 921819535/cms
        public static void Init()
        {
            AspNetInitializer.Init();
            Cms.OfficialEnvironment = false;
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new AspNetCacheWrapper());
            //Cms.OnInit += CmsEventRegister.Init;
            Cms.Init(BootFlag.Normal, null);
            //注册路由;
            Routes.MapRoutes(RouteTable.Routes);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();

            //RouteDebug.RouteDebugger.RewriteRoutesForTesting(routes);

            //加载自定义插件
            //Cms.Plugins.Extends.LoadFromAssembly(typeof(sp.datapicker.CollectionExtend).Assembly);

            //注册定时任务
            // CmsTask.Init();


            //设置可写权限
            Cms.Utility.SetDirCanWrite("bin");
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");
        }
コード例 #4
0
ファイル: CmsEventRegister.cs プロジェクト: wangjiec1/cms
        /// <summary>
        /// CMS初始化
        /// </summary>
        public static void Init()
        {
            //读取站点
            if (Cms.IsInstalled())
            {
                Cms.RegSites(SiteCacheManager.GetAllSites().ToArray());
            }

            //内嵌资源释放
            SiteResourceInit.Init();

            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");
            Cms.Utility.SetDirHidden("bin");
        }