public void MongoDbConventionTest() { MongoDbConvention.SetCamelCaseElementNameConvention(); var convention = ConventionRegistry.Lookup(typeof(Type)).Conventions.FirstOrDefault(c => c.Name == "CamelCaseElementName"); convention.Should().NotBeNull(); }
/// <summary> /// Gets MongoDb services. /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> /// <returns></returns> public static IServiceCollection AddMongoDb(this IServiceCollection services, IConfiguration configuration) { MongoDbConvention.SetCamelCaseElementNameConvention(); services.Configure <MongoDbConfiguration>(configuration.GetSection("Database")); services.TryAddSingleton <IValidateOptions <MongoDbConfiguration>, MongoDbConfigurationValidation>(); services.AddSingleton <IDataRepository, DataRepository>(); return(services); }
public MongoProvider(SeederConfiguration configuration) { MongoDbConvention.SetCamelCaseElementNameConvention(); Collections = new List <ISeed> { new MongoDiscountSeed(configuration), new MongoTagSeed(configuration), new MongoUserSeed(configuration), new MongoExternalUserSeed(configuration) }; }
/// <summary> /// Gets MongoDb services. /// </summary> /// <param name="services"></param> /// <returns></returns> public static IServiceCollection AddMongoDb(this IServiceCollection services) { MongoDbConvention.SetCamelCaseElementNameConvention(); services.AddSingleton <IDbConfiguration, MongoDbConfiguration>(); services.AddSingleton <IDiscountRepository, DiscountRepository>(); services.AddSingleton <IAddressRepository, QuickSearchRepository>(); services.AddSingleton <ICompanyRepository, QuickSearchRepository>(); services.AddSingleton <IUserRepository, UserRepository>(); services.AddSingleton <ITagRepository, QuickSearchRepository>(); services.AddSingleton <IStatisticsRepository, StatisticsRepository>(); return(services); }