private static void ConfigureForAzureStorage(ContainerBuilder builder, ConfigurationService configuration) { builder.RegisterInstance(new CloudBlobClientWrapper(configuration.Current.AzureStorageConnectionString, configuration.Current.AzureStorageReadAccessGeoRedundant)) .AsSelf() .As <ICloudBlobClient>() .SingleInstance(); builder.RegisterType <CloudBlobFileStorageService>() .AsSelf() .As <IFileStorageService>() .SingleInstance(); // when running on Windows Azure, we use a back-end job to calculate stats totals and store in the blobs builder.RegisterInstance(new JsonAggregateStatsService(configuration.Current.AzureStorageConnectionString, configuration.Current.AzureStorageReadAccessGeoRedundant)) .AsSelf() .As <IAggregateStatsService>() .SingleInstance(); // when running on Windows Azure, pull the statistics from the warehouse via storage builder.RegisterInstance(new CloudReportService(configuration.Current.AzureStorageConnectionString, configuration.Current.AzureStorageReadAccessGeoRedundant)) .AsSelf() .As <IReportService>() .SingleInstance(); // when running on Windows Azure, download counts come from the downloads.v1.json blob var downloadCountService = new CloudDownloadCountService(configuration.Current.AzureStorageConnectionString, configuration.Current.AzureStorageReadAccessGeoRedundant); builder.RegisterInstance(downloadCountService) .AsSelf() .As <IDownloadCountService>() .SingleInstance(); ObjectMaterializedInterception.AddInterceptor(new DownloadCountObjectMaterializedInterceptor(downloadCountService)); builder.RegisterType <JsonStatisticsService>() .AsSelf() .As <IStatisticsService>() .SingleInstance(); string instanceId; try { instanceId = RoleEnvironment.CurrentRoleInstance.Id; } catch { instanceId = Environment.MachineName; } var localIp = AuditActor.GetLocalIP().Result; builder.RegisterInstance(new CloudAuditingService(instanceId, localIp, configuration.Current.AzureStorageConnectionString, CloudAuditingService.AspNetActorThunk)) .AsSelf() .As <AuditingService>() .SingleInstance(); }
internal static async Task <Uri> SaveAuditRecord(CloudStorageAccount storage, AuditRecord auditRecord) { string localIP = await AuditActor.GetLocalIP(); CloudAuditingService audit = new CloudAuditingService( Environment.MachineName, localIP, storage.CreateCloudBlobClient().GetContainerReference("auditing"), onBehalfOfThunk: null); return(await audit.SaveAuditRecord(auditRecord)); }
private void ConfigureForAzureStorage(ConfigurationService configuration) { Bind <ICloudBlobClient>() .ToMethod(_ => new CloudBlobClientWrapper(configuration.Current.AzureStorageConnectionString)) .InSingletonScope(); Bind <IFileStorageService>() .To <CloudBlobFileStorageService>() .InSingletonScope(); // when running on Windows Azure, we use a back-end job to calculate stats totals and store in the blobs Bind <IAggregateStatsService>() .ToMethod(_ => new JsonAggregateStatsService(configuration.Current.AzureStorageConnectionString)) .InSingletonScope(); // when running on Windows Azure, pull the statistics from the warehouse via storage Bind <IReportService>() .ToMethod(_ => new CloudReportService(configuration.Current.AzureStorageConnectionString)) .InSingletonScope(); Bind <IStatisticsService>() .To <JsonStatisticsService>() .InSingletonScope(); string instanceId; try { instanceId = RoleEnvironment.CurrentRoleInstance.Id; } catch (Exception) { instanceId = Environment.MachineName; } var localIP = AuditActor.GetLocalIP().Result; Bind <AuditingService>() .ToMethod(_ => new CloudAuditingService( instanceId, localIP, configuration.Current.AzureStorageConnectionString, CloudAuditingService.AspNetActorThunk)) .InSingletonScope(); }