|
|
@@ -0,0 +1,55 @@
|
|
|
+using Autofac.Core;
|
|
|
+using BaseService.HttpApi.Client;
|
|
|
+using Business.Core.MongoDBHelper;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
+using Microsoft.Extensions.DependencyInjection;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Volo.Abp.Application;
|
|
|
+using Volo.Abp.AutoMapper;
|
|
|
+using Volo.Abp.Http.Client.IdentityModel;
|
|
|
+using Volo.Abp.Identity;
|
|
|
+using Volo.Abp.Modularity;
|
|
|
+using XCZ;
|
|
|
+
|
|
|
+namespace Business.Tests
|
|
|
+{
|
|
|
+ [DependsOn(
|
|
|
+ typeof(BusinessDomainModule),
|
|
|
+ typeof(BusinessApplicationContractsModule),
|
|
|
+ typeof(AbpDddApplicationModule),
|
|
|
+ typeof(AbpHttpClientIdentityModelModule),
|
|
|
+ typeof(AbpIdentityHttpApiClientModule),
|
|
|
+ typeof(BaseServiceHttpApiClientModule),
|
|
|
+ typeof(FormApplicationModule),
|
|
|
+ typeof(FlowApplicationModule),
|
|
|
+ typeof(AbpAutoMapperModule))]
|
|
|
+ public class BusinessTestModule:AbpModule
|
|
|
+ {
|
|
|
+ public override void ConfigureServices(ServiceConfigurationContext context)
|
|
|
+ {
|
|
|
+ //MongoDBHelper依赖注入
|
|
|
+ context.Services.AddScoped(typeof(IMongoDB<>), typeof(MongoDBTools<>));
|
|
|
+
|
|
|
+ var configuration = context.Services.GetConfiguration();
|
|
|
+ //MongoDB依赖注入
|
|
|
+ ConfigureMongoDB(configuration);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// MongoDB依赖注入
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="context"></param>
|
|
|
+ /// <param name="configuration"></param>
|
|
|
+ private void ConfigureMongoDB(IConfiguration configuration)
|
|
|
+ {
|
|
|
+ Configure<Config>(options => {
|
|
|
+ options.connectstring = configuration.GetConnectionString("MongoDB");
|
|
|
+ options.database = configuration.GetConnectionString("DBName");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|