public static IStorageBuilder UseInMemoryDatabase(this IStorageBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } builder.UseDatabase <InMemoryDatabase>(); return(builder); }
public static IStorageBuilder UseMongoDB(this IStorageBuilder builder, bool useNativeTransactions = false) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } builder.Services.AddOptions(); builder.Services.AddSingleton(BuildMongoClient); builder.Services.AddSingleton(BuildMongoDatabase); if (useNativeTransactions) { builder.UseTransactionalDatabase <MongoDatabase>(); } else { builder.UseDatabase <MongoDatabase>(); } return(builder); }