コード例 #1
0
ファイル: CrmServiceFactory.cs プロジェクト: rhw1111/DCEM
        private ICrmServiceFactoryService getService(CrmServiceFactory factory)
        {
            if (!_serviceFactories.TryGetValue(factory.Type, out IFactory <ICrmServiceFactoryService> serviceFactory))
            {
                var fragment = new TextFragment()
                {
                    Code = TextCodes.NotFoundCrmServiceFactoryServiceByType,
                    DefaultFormatting = "找不到类型为{0}的Crm服务工厂服务,发生位置:{1}",
                    ReplaceParameters = new List <object>()
                    {
                        factory.Type, $"{this.GetType().FullName}.ServiceFactories"
                    }
                };

                throw new UtilityException((int)Errors.NotFoundCrmServiceFactoryServiceByType, fragment);
            }

            return(serviceFactory.Create());
        }
コード例 #2
0
ファイル: CrmServiceFactory.cs プロジェクト: rhw1111/DCEM
        public async Task <ICrmService> Create(CrmServiceFactory factory)
        {
            var factoryService = getService(factory);

            return(await factoryService.Create(factory.Configuration));
        }