Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        public async Task <ICrmService> Create(CrmServiceFactory factory)
        {
            var factoryService = getService(factory);

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