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.
28 lines
850 B
28 lines
850 B
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
namespace Volo.Abp.MongoDB.DependencyInjection
|
|
{
|
|
public class AbpMongoDbConventionalRegistrar : DefaultConventionalRegistrar
|
|
{
|
|
public override void AddType(IServiceCollection services, Type type)
|
|
{
|
|
if (!typeof(IAbpMongoDbContext).IsAssignableFrom(type) || type == typeof(AbpMongoDbContext))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var dependencyAttribute = GetDependencyAttributeOrNull(type);
|
|
var lifeTime = GetLifeTimeOrNull(type, dependencyAttribute);
|
|
|
|
if (lifeTime == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
services.Add(ServiceDescriptor.Describe(typeof(IAbpMongoDbContext), type, ServiceLifetime.Transient));
|
|
}
|
|
}
|
|
}
|