Exemple #1
0
        private void SetupStoreDriver(IServiceCollection services, DocumentsAPIConfiguration configuration)
        {
            /* Stores */
            services.AddTransient <IOrganizationStore, OrganizationStore>();
            services.AddTransient <IFolderStore, FolderStore>();
            services.AddTransient <IFileStore, FileStore>();
            services.AddTransient <IUserStore, UserStore>();
            services.AddTransient <IAuditLogEntryStore, AuditLogEntryStore>();
            services.AddTransient <IUploadStore, UploadStore>();
            services.AddTransient <IUploadChunkStore, UploadChunkStore>();
            services.AddTransient <IHealthStore, HealthStore>();

            services.AddTransient <ISearch>((sp) =>
            {
                return(new ElasticSearchDriver(
                           sp.GetService <ILogger <ElasticSearchDriver> >(),
                           configuration.ElasticSearchUri,
                           configuration.ElasticSearchIndex
                           ));
            }
                                            );


            // todo: somehow needs to move into driver initialization
            /* EntityFramework */
            services.AddEntityFrameworkSqlServer()
            .AddDbContext <DocumentsContext>(options =>
            {
                options.UseSqlServer(configuration.ConnectionString)
                .ConfigureWarnings(warnings => warnings.Throw(CoreEventId.IncludeIgnoredWarning));
            });

            services.BuildServiceProvider().GetService <DocumentsContext>().Initialize();
        }
Exemple #2
0
 public BackendClient(
     ISecurityContext securityContext,
     DocumentsAPIConfiguration documentsConfiguration,
     ILogger <BackendClient> logger
     )
 {
     this.SecurityContext           = securityContext;
     this.DocumentsAPIConfiguration = documentsConfiguration;
     this.Logger = logger;
 }