Ejemplo n.º 1
0
        public EmailSender(
            IEnumerable <IEmailProviderType> emailProviderTypes,
            IOptions <EmailOptions> options,
            IStorageFactory storageFactory,
            ITemplateLoaderFactory templateLoaderFactory)
        {
            this.options = options.Value;

            var providerType = emailProviderTypes
                               .FirstOrDefault(x => x.Name == this.options.Provider.Type);

            if (providerType == null)
            {
                throw new ArgumentNullException("ProviderType", $"The provider type {this.options.Provider.Type} does not exist. Maybe you are missing a reference or an Add method call in your Startup class.");
            }

            this.provider = providerType.BuildProvider(this.options.Provider);

            if (!string.IsNullOrWhiteSpace(this.options.TemplateStorage))
            {
                var store = storageFactory.GetStore(this.options.TemplateStorage);
                if (store == null)
                {
                    throw new ArgumentNullException("TemplateStorage", $"There is no file store configured with name {this.options.TemplateStorage}. Unable to initialize email templating.");
                }

                this.templateLoader = templateLoaderFactory.Create(store);
            }
        }
Ejemplo n.º 2
0
 public DefinitionExecutor(
     ITemplateLoaderFactory templateLoaderFactory,
     IEngineFactory engineFactory,
     IResultProcessorFactory resultProcessorFactory
     )
 {
     _templateLoaderFactory  = templateLoaderFactory;
     _engineFactory          = engineFactory;
     _resultProcessorFactory = resultProcessorFactory;
 }