|
|
|
@ -13,7 +13,6 @@ namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
where TMongoDbContext : AbpMongoDbContext
|
|
|
|
where TMongoDbContext : AbpMongoDbContext
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var options = new AbpMongoDbContextRegistrationOptions(typeof(TMongoDbContext), services);
|
|
|
|
var options = new AbpMongoDbContextRegistrationOptions(typeof(TMongoDbContext), services);
|
|
|
|
optionsBuilder?.Invoke(options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var replaceDbContextAttribute = typeof(TMongoDbContext).GetCustomAttribute<ReplaceDbContextAttribute>(true);
|
|
|
|
var replaceDbContextAttribute = typeof(TMongoDbContext).GetCustomAttribute<ReplaceDbContextAttribute>(true);
|
|
|
|
if (replaceDbContextAttribute != null)
|
|
|
|
if (replaceDbContextAttribute != null)
|
|
|
|
@ -21,6 +20,8 @@ namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
options.ReplacedDbContextTypes.AddRange(replaceDbContextAttribute.ReplacedDbContextTypes);
|
|
|
|
options.ReplacedDbContextTypes.AddRange(replaceDbContextAttribute.ReplacedDbContextTypes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
optionsBuilder?.Invoke(options);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var dbContextType in options.ReplacedDbContextTypes)
|
|
|
|
foreach (var dbContextType in options.ReplacedDbContextTypes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
services.Replace(ServiceDescriptor.Transient(dbContextType, typeof(TMongoDbContext)));
|
|
|
|
services.Replace(ServiceDescriptor.Transient(dbContextType, typeof(TMongoDbContext)));
|
|
|
|
|