Exemple #1
0
        public static IServiceCollection AddAccessors(this IServiceCollection services, string mongoDbConnectionString, string mongoDbName)
        {
            var mongoContext = new MongoContext(mongoDbConnectionString, mongoDbName);

            mongoContext.CreateIndexes();
            services.AddScoped(p => mongoContext);

            services.AddTransient <IFileAccessor, FileAccessor>();
            services.AddTransient <ISeriesAccessor, SeriesAccessor>();
            services.AddTransient <IMissionAccessor, MissionAccessor>();
            services.AddTransient <ILogAccessor, LogAccessor>();
            services.AddTransient <IEventAccessor, EventAccessor>();

            return(services);
        }