コード例 #1
0
        /// <summary>
        /// 开始 Senparc.CO2NET SDK 初始化参数流程(.NET Core)
        /// </summary>
        /// <param name="senparcSetting"></param>
        /// <param name="contentRootPath">asp.net core应用中IHostingEnvironment对象的ContentRootPath</param>
        /// <returns></returns>
        public static IRegisterService Start(SenparcSetting senparcSetting, string contentRootPath = "")
        {
            if (!string.IsNullOrWhiteSpace(contentRootPath))
            {
                Config.RootDictionaryPath = contentRootPath;
            }
            var registerService = new YoyoAbpWechatRegisterService(senparcSetting);

            registerService.RegisterThreads();
            return(registerService);
        }
コード例 #2
0
        /// <summary>
        /// 开始YoYo Senparc.CO2NET SDK 初始化参数流程
        ///
        /// (关于 UseYoYoSenparc() 的更多用法见 CO2NET Demo 中的 UseSenparcGlobal:https://github.com/Senparc/Senparc.CO2NET/blob/master/Sample/Senparc.CO2NET.Sample.netcore/Startup.cs)
        /// </summary>
        /// <param name="senparcSetting"></param>
        /// <param name="contentRootPath">提供网站根目录(env.ContentRootPath,env类型为IHostingEnvironment)</param>
        /// <param name="autoScanExtensionCacheStrategies">是否自动扫描全局的扩展缓存(会增加系统启动时间)</param>
        /// <param name="extensionCacheStrategiesFunc">
        /// <para>需要手动注册的扩展缓存策略</para>
        /// <para>(LocalContainerCacheStrategy、RedisContainerCacheStrategy、MemcacheContainerCacheStrategy已经自动注册),</para>
        /// <para>如果设置为 null(注意:不是委托返回 null,是整个委托参数为 null),则自动使用反射扫描所有可能存在的扩展缓存策略</para>
        /// </param>
        /// <returns></returns>
        public static IRegisterService UseYoYoSenparcCO2NET(
            this SenparcSetting senparcSetting,
            string contentRootPath = "",
            bool autoScanExtensionCacheStrategies = false,
            Func <IList <IDomainExtensionCacheStrategy> > extensionCacheStrategiesFunc = null)
        {
            var registerService = YoyoAbpWechatRegisterService.Start(senparcSetting, contentRootPath);

            CacheStrategyDomainWarehouse.AutoScanDomainCacheStrategy(autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);

            return(registerService);
        }