mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp.Data;
|
|
using Volo.Abp.Modularity;
|
|
using Volo.Abp.TestApp;
|
|
using Volo.Abp.TestApp.Domain;
|
|
using Volo.Abp.TestApp.MongoDB;
|
|
|
|
namespace Volo.Abp.MongoDB
|
|
{
|
|
[DependsOn(
|
|
typeof(AbpMongoDbModule),
|
|
typeof(TestAppModule)
|
|
)]
|
|
public class AbpMongoDbTestModule : AbpModule
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
|
|
"Db_" +
|
|
Guid.NewGuid().ToString("N");
|
|
|
|
Configure<AbpDbConnectionOptions>(options =>
|
|
{
|
|
options.ConnectionStrings.Default = connectionString;
|
|
});
|
|
|
|
context.Services.AddMongoDbContext<TestAppMongoDbContext>(options =>
|
|
{
|
|
options.AddDefaultRepositories<ITestAppMongoDbContext>();
|
|
options.AddRepository<City, CityRepository>();
|
|
});
|
|
}
|
|
}
|
|
}
|