コード例 #1
0
ファイル: EmailSender.cs プロジェクト: arcotn/gl-dotnet-email
        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);
            }
        }
コード例 #2
0
        public GenericStoreProxy(IStorageFactory factory, IOptions <TOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options", "Unable to build generic Store. Did you forget to configure your options?");
            }

            this.innerStore = factory.GetStore(options.Value.Name, options.Value);
        }
コード例 #3
0
 public FileController(IStorageFactory storageFactory,
                       IPostService postService,
                       IFileService fileService,
                       IGroupService groupService)
 {
     this.fileStore    = storageFactory.GetStore("LocalFileStorage");
     this.postService  = postService;
     this.fileService  = fileService;
     this.groupService = groupService;
 }
コード例 #4
0
 public StoreBase(string storeName, IStorageFactory storageFactory)
 {
     this.store = storageFactory.GetStore(storeName);
 }
コード例 #5
0
 public SampleController(IStorageFactory storageFactory)
 {
     this.sharedAssets = storageFactory.GetStore("SharedAssets");
 }
コード例 #6
0
 public FileService(IStorageFactory storageFactory)
 {
     this.fileStore = storageFactory.GetStore("LocalFileStorage");
     this.webClient = new WebClient();
 }