public static ConfigurationRootModel BuildContainer(
            ContainerBuilder containerBuilder,
            IServiceFabricConfigurationService serviceFabricConfigurationService)
        {
            IStatelessServiceConfiguration statelessServiceConfiguration = serviceFabricConfigurationService.GetConfigSectionAsStatelessServiceConfiguration();

            containerBuilder.RegisterModule(new StatelessServiceModule(statelessServiceConfiguration));

            ReportServiceConfiguration reportServiceConfiguration = serviceFabricConfigurationService.GetConfigSectionAs <ReportServiceConfiguration>("ReportServiceConfiguration");
            AzureStorageOptions        azureBlobStorageOptions    = serviceFabricConfigurationService.GetConfigSectionAs <AzureStorageOptions>("AzureStorageSection");
            VersionInfo versionInfo = serviceFabricConfigurationService.GetConfigSectionAs <VersionInfo>("VersionSection");

            // register message mapper
            containerBuilder.RegisterType <DefaultJobContextMessageMapper <JobContextMessage> >().As <IMapper <JobContextMessage, JobContextMessage> >();

            // register MessageHandler
            containerBuilder.RegisterType <MessageHandler>().As <IMessageHandler <JobContextMessage> >().InstancePerLifetimeScope();

            containerBuilder.RegisterType <JobContextManager <JobContextMessage> >().As <IJobContextManager <JobContextMessage> >()
            .InstancePerLifetimeScope();

            containerBuilder.RegisterType <JobContextMessage>().As <IJobContextMessage>()
            .InstancePerLifetimeScope();

            containerBuilder.RegisterModule <SerializationModule>();

            return(new ConfigurationRootModel
            {
                reportServiceConfiguration = reportServiceConfiguration,
                azureBlobStorageOptions = azureBlobStorageOptions,
                versionInfo = versionInfo
            });
        }
Exemplo n.º 2
0
 public PostCache(
     IOptionsMonitor <AzureStorageOptions> optionsMonitor,
     CloudTableClient cloudTableClient)
 {
     this._posts            = new List <Post>();
     this._options          = optionsMonitor?.CurrentValue ?? throw new ArgumentNullException(nameof(optionsMonitor));
     this._cloudTableClient = cloudTableClient ?? throw new ArgumentNullException(nameof(cloudTableClient));
     this._timeStamp        = this.RefreshCache();
 }
Exemplo n.º 3
0
 public static void BuildStorageFileSystem(
     ContainerBuilder containerBuilder,
     AzureStorageOptions azureBlobStorageOptions,
     IStreamableKeyValuePersistenceService storagePersistenceService)
 {
     containerBuilder.RegisterInstance(azureBlobStorageOptions).As <IAzureStorageOptions>();
     containerBuilder.RegisterType <FileSystemFileService>().As <IFileService>();
     containerBuilder.RegisterInstance(storagePersistenceService)
     .As <IStreamableKeyValuePersistenceService>()
     .SingleInstance();
 }
 public AzureStorageBlogService(
     IPostCache postCache,
     IWebHostEnvironment env,
     IHttpContextAccessor contextAccessor,
     IOptionsMonitor <AzureStorageOptions> optionsMonitor,
     CloudTableClient cloudTableClient)
     : base(postCache, env, contextAccessor)
 {
     this._options          = optionsMonitor?.CurrentValue ?? throw new ArgumentNullException(nameof(optionsMonitor));
     this._cloudTableClient = cloudTableClient ?? throw new ArgumentNullException(nameof(cloudTableClient));
 }
Exemplo n.º 5
0
 public static void AddAzureStorageContext(this IServiceCollection services, Action <AzureStorageOptions> setupAction)
 {
     if (setupAction == null)
     {
         throw new ArgumentNullException(nameof(setupAction));
     }
     services.AddSingleton <AzureStorageContext>((serviceProvider) => {
         AzureStorageOptions options = new AzureStorageOptions();
         setupAction(options);
         return(new DefaultAzureStorageContext(options.ConnectionString));
     });
 }
Exemplo n.º 6
0
        public static void AddAzureStorageContext <TAzureStorageContext>(this IServiceCollection services, Action <AzureStorageOptions> setupAction)
            where TAzureStorageContext : AzureStorageContext
        {
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            services.AddSingleton <TAzureStorageContext>((serviceProvider) => {
                AzureStorageOptions options = new AzureStorageOptions();
                setupAction(options);
                return((TAzureStorageContext)Activator.CreateInstance(typeof(TAzureStorageContext), new object[] { options.ConnectionString }));
            });
        }
Exemplo n.º 7
0
        public static void BuildStorageContainerAzure(
            ContainerBuilder containerBuilder,
            AzureStorageOptions azureBlobStorageOptions)
        {
            // register azure blob storage service
            containerBuilder.RegisterInstance(azureBlobStorageOptions).As <IAzureStorageOptions>();
            containerBuilder.Register(c =>
                                      new AzureStorageKeyValuePersistenceConfig(
                                          azureBlobStorageOptions.AzureBlobConnectionString,
                                          azureBlobStorageOptions.AzureBlobContainerName))
            .As <IAzureStorageKeyValuePersistenceServiceConfig>().SingleInstance();

            containerBuilder.RegisterType <AzureStorageKeyValuePersistenceService>()
            .As <IStreamableKeyValuePersistenceService>()
            .InstancePerLifetimeScope();

            AzureStorageFileServiceConfiguration azureStorageFileServiceConfiguration = new AzureStorageFileServiceConfiguration()
            {
                ConnectionString = azureBlobStorageOptions.AzureBlobConnectionString,
            };

            containerBuilder.RegisterInstance(azureStorageFileServiceConfiguration).As <IAzureStorageFileServiceConfiguration>();
            containerBuilder.RegisterType <AzureStorageFileService>().As <IFileService>();
        }
 public StorageService(IOptions <AzureStorageOptions> options)
 {
     _options = options.Value;
 }
Exemplo n.º 9
0
 public UploadService(AzureStorageOptions storageOptions)
 {
     this.StorageOptions = storageOptions;
 }
Exemplo n.º 10
0
 public AzureStorageScheduleConnectorService(AzureStorageOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
Exemplo n.º 11
0
 public QueueService(AzureStorageOptions storageOptions)
 {
     this.StorageOptions = storageOptions;
 }
Exemplo n.º 12
0
 public ApplicationTeamMembersStorageProvider(AzureStorageOptions azureStorageOptions)
     : base(azureStorageOptions, "application-team-members")
 {
 }
Exemplo n.º 13
0
 public QueuePusher(IOptions <AzureStorageOptions> azureStorageOptions, JsonSerializer jsonSerializer)
 {
     _jsonSerializer      = jsonSerializer;
     _azureStorageOptions = azureStorageOptions.Value;
 }
Exemplo n.º 14
0
 public ImagesController(IOptionsSnapshot <AzureStorageOptions> azureStorageOptions, IOptionsSnapshot <AzureAdOptions> azureAdOptions)
 {
     _azureAdOptions      = azureAdOptions.Value;
     _azureStorageOptions = azureStorageOptions.Value;
 }
 public AzureBlobStorageService(AzureStorageOptions options)
 {
     _options           = options;
     _blobServiceClient = new BlobServiceClient(options.StorageConnectionString);
 }
 public ExpertApplicationsStorageProvider(AzureStorageOptions azureStorageOptions)
     : base(azureStorageOptions, "expert-applications")
 {
 }
 public TeamCloudAdapterAuthorizeOptions(AzureStorageOptions azureStorageOptions)
 {
     this.azureStorageOptions = azureStorageOptions ?? throw new ArgumentNullException(nameof(azureStorageOptions));
 }
Exemplo n.º 18
0
 public ProjectStorageProvider(AzureStorageOptions azureStorageOptions)
     : base(azureStorageOptions, "projects")
 {
 }
Exemplo n.º 19
0
 public OneTimeTokenServiceOptions(AzureStorageOptions azureStorageOptions)
 {
     this.azureStorageOptions = azureStorageOptions ?? throw new ArgumentNullException(nameof(azureStorageOptions));
 }
Exemplo n.º 20
0
 public AuthorizationTokenOptions(AzureStorageOptions azureStorageOptions)
 {
     this.azureStorageOptions = azureStorageOptions ?? throw new ArgumentNullException(nameof(azureStorageOptions));
 }
Exemplo n.º 21
0
 public QueueService(IOptions <AzureStorageOptions> storageOptions)
 {
     this.StorageOptions = storageOptions?.Value;
 }
Exemplo n.º 22
0
 public ProjectTeamMembersStorageProvider(AzureStorageOptions azureStorageOptions)
     : base(azureStorageOptions, "project-team-members")
 {
 }
 public AzureStorageAppService(AzureStorageOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
Exemplo n.º 24
0
 public AzureStorageScheduleCacheService(AzureStorageOptions options, ILogger <AzureStorageBlobService> log)
     : base(options, log)
 {
 }
 private static IServiceCollection AddAzureStorageService(this IServiceCollection services, AzureStorageOptions options)
 {
     services.AddSingleton(_ =>
     {
         var storageCredentials = new StorageCredentials(
             accountName: options.AccountName,
             keyValue: options.AccountKey1 ?? options.AccountKey2);
         var storageAccount = new CloudStorageAccount(
             storageCredentials: storageCredentials,
             useHttps: true);
         return(storageAccount.CreateCloudBlobClient());
     });
     services.AddSingleton <IStorageService, AzureStorageService>();
     return(services);
 }
Exemplo n.º 26
0
 public UploadService(IOptions <AzureStorageOptions> storageOptions)
 {
     this.StorageOptions = storageOptions?.Value;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AzureFileShareStorageManager" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public AzureFileShareStorageManager(AzureStorageOptions options)
 {
     this._shareClient = new ShareClient(options.ConnectionString, options.Name);
 }
 public AzureStorageBlobService(AzureStorageOptions options, ILogger <AzureStorageBlobService> log)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _log     = log ?? throw new ArgumentNullException(nameof(log));
 }