コード例 #1
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Ask.Resources.Resource", typeof(Spacebuilder.Ask.Resources.Resource).Assembly);

            //评论设置的注册
            TenantCommentSettings.RegisterSettings(tenantCommentSettingsElement);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);

            //注册问答正文解析器
            containerBuilder.Register(c => new AskBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().Ask()).SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new AskSearcher("问答", "~/App_Data/IndexFiles/Ask", true, 8)).As <ISearcher>().Named <ISearcher>(AskSearcher.CODE).SingleInstance();

            //问题应用数据统计
            containerBuilder.Register(c => new AskQuestionApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();

            //注册问题解析器
            containerBuilder.Register(c => new AskBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().AskQuestion()).SingleInstance();

            //注册回答解析器
            containerBuilder.Register(c => new AskBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().AskAnswer()).SingleInstance();

            //注册动态接收人获取器
            containerBuilder.Register(c => new SubscribeQuestionActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().AskQuestion().ToString()).SingleInstance();
            containerBuilder.Register(c => new SubscribeTagActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().AskTag().ToString()).SingleInstance();
        }
コード例 #2
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Blog.Resources.Resource", typeof(Spacebuilder.Blog.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            TenantCommentSettings.RegisterSettings(tenantCommentSettingsElement);

            //注册日志站点设置
            containerBuilder.Register(c => new BlogSettingsManager()).As <IBlogSettingsManager>().SingleInstance();

            //注册日志正文解析器
            containerBuilder.Register(c => new BlogBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().Blog()).SingleInstance();

            //注册EventModule
            containerBuilder.Register(c => new BlogThreadEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BlogIndexEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BlogOperationLogEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BlogActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().Blog().ToString()).SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new BlogSearcher("日志", "~/App_Data/IndexFiles/Blog", true, 3)).As <ISearcher>().Named <ISearcher>(BlogSearcher.CODE).SingleInstance();

            //日志应用数据统计
            containerBuilder.Register(c => new BlogApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
            containerBuilder.Register(c => new BlogCommentUrlGetter()).As <ICommentUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BlogRecommendUrlGetter()).As <IRecommendUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BlogOwnerDataGetter()).As <IOwnerDataGetter>().SingleInstance();
            containerBuilder.Register(c => new BlogAtUserAssociatedUrlGetter()).As <IAtUserAssociatedUrlGetter>().SingleInstance();
        }
コード例 #3
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.PointMall.Resources.Resource", typeof(Spacebuilder.PointMall.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);

            //问题应用数据统计
            containerBuilder.Register(c => new PointMallApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
        }
コード例 #4
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Microblog.Resources.Resource", typeof(Spacebuilder.Microblog.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            containerBuilder.Register(c => new MicroblogSearcher("微博", "~/App_Data/IndexFiles/Microblog", true, 2)).As <ISearcher>().Named <ISearcher>(MicroblogSearcher.CODE).SingleInstance();
            containerBuilder.Register(c => new MicroblogBodyProcessor()).As <IMicroblogBodyProcessor>().SingleInstance();
            containerBuilder.Register(c => new MicroblogApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
            containerBuilder.Register(c => new MicroblogTenantAuthorizationHandler()).As <ITenantAuthorizationHandler>().SingleInstance();
        }
コード例 #5
0
ファイル: UpgradeController.cs プロジェクト: yaotyl/spb4mono
        public ActionResult Upgrading_Database_Ready()
        {
            SqlConnection sqlConnection = GetConnection();

            //注册应用中的Application.Config
            foreach (var applicationConfig in ApplicationConfigManager.Instance().GetAllApplicationConfigs())
            {
                if (applicationConfig.Element("tenantAttachmentSettings") != null)
                {
                    TenantAttachmentSettings.RegisterSettings(applicationConfig.Element("tenantAttachmentSettings"));
                }
                if (applicationConfig.Element("tenantLogoSettings") != null)
                {
                    TenantLogoSettings.RegisterSettings(applicationConfig.Element("tenantLogoSettings"));
                }
            }

            ConcurrentDictionary <string, string> messages = new ConcurrentDictionary <string, string>();

            //修改3.2版本的表名
            string reNameSqlFile = SetupHelper.GetUpgradeReNameFile();

            try
            {
                SetupHelper.ExecuteInFile(sqlConnection, reNameSqlFile, out messages);
            }
            catch (Exception e)
            {
                if (!messages.ContainsKey("在文件:" + reNameSqlFile + " 中产生异常"))
                {
                    messages["在文件:" + reNameSqlFile + " 中产生异常"] = e.Message + "\r\n";
                }
                else
                {
                    messages["在文件:" + reNameSqlFile + " 中产生异常"] += e.Message + "\r\n";
                }
            }

            foreach (var message in messages)
            {
                WriteLogFile(string.Format("{0}:{1}", message.Key, message.Value));
            }
            if (messages.Count > 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "升级数据库准备失败,请查看升级日志")));
            }
            else
            {
                return(Json(new StatusMessageData(StatusMessageType.Success, "升级数据库准备就绪。")));
            }
        }
コード例 #6
0
ファイル: PhotoConfig.cs プロジェクト: x1987624/SNS
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Photo.Resources.Resource", typeof(Spacebuilder.Photo.Resources.Resource).Assembly);

            //评论设置的注册
            TenantCommentSettings.RegisterSettings(tenantCommentSettingsElement);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);

            //注册全文检索搜索器
            containerBuilder.Register(c => new PhotoSearcher("相册", "~/App_Data/IndexFiles/Photo", true, 5)).As <ISearcher>().Named <ISearcher>(PhotoSearcher.CODE).SingleInstance();

            //问题应用数据统计
            containerBuilder.Register(c => new PhotoApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
        }
コード例 #7
0
ファイル: WikiConfig.cs プロジェクト: x1987624/SNS
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Wiki.Resources.Resource", typeof(Spacebuilder.Wiki.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            //注册百科正文解析器
            containerBuilder.Register(c => new WikiBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().WikiPage()).SingleInstance();
            containerBuilder.Register(c => new DefaultPageIdToTitleDictionary()).As <PageIdToTitleDictionary>().SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new WikiSearcher("百科", "~/App_Data/IndexFiles/Wiki", true, 3)).As <ISearcher>().Named <ISearcher>(WikiSearcher.CODE).SingleInstance();


            containerBuilder.Register(c => new WikiApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
        }
コード例 #8
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Bar.Resources.Resource", typeof(Spacebuilder.Bar.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            //注册标识图设置
            TenantLogoSettings.RegisterSettings(tenantLogoSettingsElement);

            //注册帖吧正文解析器
            containerBuilder.Register(c => new BarBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().Bar()).SingleInstance();
            containerBuilder.Register(c => new BarSectionActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().BarSection().ToString()).SingleInstance();
            containerBuilder.Register(c => new BarSearcher("帖吧", "~/App_Data/IndexFiles/Bar", true, 6)).As <ISearcher>().Named <ISearcher>(BarSearcher.CODE).SingleInstance();

            containerBuilder.Register(c => new BarApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();

            containerBuilder.Register(c => new BarTenantAuthorizationHandler()).As <ITenantAuthorizationHandler>().SingleInstance();
        }
コード例 #9
0
ファイル: CmsConfig.cs プロジェクト: x1987624/SNS
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.CMS.Resources.Resource", typeof(Spacebuilder.CMS.Resources.Resource).Assembly);

            //注册EventModule
            containerBuilder.RegisterAssemblyTypes(Assembly.Load("Spacebuilder.CMS")).Where(t => typeof(IEventMoudle).IsAssignableFrom(t)).As <IEventMoudle>().SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new CmsSearcher("资讯", "~/App_Data/IndexFiles/Cms", true, 4)).As <ISearcher>().Named <ISearcher>(CmsSearcher.CODE).SingleInstance();

            //资讯应用数据统计
            containerBuilder.Register(c => new CmsApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();

            //注册资讯解析器
            containerBuilder.Register(c => new CmsBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().ContentItem()).SingleInstance();

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);

            //评论设置的注册
            TenantCommentSettings.RegisterSettings(tenantCommentSettingsElement);
        }
コード例 #10
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Bar.Resources.Resource", typeof(Spacebuilder.Bar.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            //注册标识图设置
            TenantLogoSettings.RegisterSettings(tenantLogoSettingsElement);

            //注册帖吧站点设置
            containerBuilder.Register(c => new BarSettingsManager()).As <IBarSettingsManager>().SingleInstance();
            //注册帖吧正文解析器
            containerBuilder.Register(c => new BarBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().Bar()).SingleInstance();
            containerBuilder.Register(c => new BarIndexEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BarRatingEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BarPostEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BarThreadEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BarSectionEventModule()).As <IEventMoudle>().SingleInstance();
            containerBuilder.Register(c => new BarSectionActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().BarSection().ToString()).SingleInstance();
            containerBuilder.Register(c => new BarSearcher("帖吧", "~/App_Data/IndexFiles/Bar", true, 5)).As <ISearcher>().Named <ISearcher>(BarSearcher.CODE).SingleInstance();
            containerBuilder.Register(c => new BarOperationLogEventModule()).As <IEventMoudle>().SingleInstance();

            containerBuilder.Register(c => new BarApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();

            containerBuilder.Register(c => new BarUrlGetter()).As <IBarUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new GroupUrlGetter()).As <IBarUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BarCommentUrlGetter()).As <ICommentUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BarOwnerDataGetter()).As <IOwnerDataGetter>().SingleInstance();
            containerBuilder.Register(c => new BarPostOwnerDataGetter()).As <IOwnerDataGetter>().SingleInstance();

            containerBuilder.Register(c => new BarTenantAuthorizationHandler()).As <ITenantAuthorizationHandler>().SingleInstance();
            containerBuilder.Register(c => new BarThreadRecommendUrlGetter()).As <IRecommendUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BarSectionRecommendUrlGetter()).As <IRecommendUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BarThreadAtUserAssociatedUrlGetter()).As <IAtUserAssociatedUrlGetter>().SingleInstance();
            containerBuilder.Register(c => new BarPostAtUserAssociatedUrlGetter()).As <IAtUserAssociatedUrlGetter>().SingleInstance();
        }