mirror of https://github.com/abpframework/abp.git
8 changed files with 103 additions and 26 deletions
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore; |
|||
|
|||
public class EfCoreDbContextTypeProvider : IEfCoreDbContextTypeProvider, ITransientDependency |
|||
{ |
|||
private readonly AbpDbContextOptions _options; |
|||
|
|||
public EfCoreDbContextTypeProvider(IOptions<AbpDbContextOptions> options) |
|||
{ |
|||
_options = options.Value; |
|||
} |
|||
|
|||
public Type GetDbContextType(Type dbContextType) |
|||
{ |
|||
return _options.GetReplacedTypeOrSelf(dbContextType); |
|||
} |
|||
|
|||
public virtual Task<Type> GetDbContextTypeAsync(Type dbContextType) |
|||
{ |
|||
return Task.FromResult(_options.GetReplacedTypeOrSelf(dbContextType)); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore; |
|||
|
|||
public interface IEfCoreDbContextTypeProvider |
|||
{ |
|||
Type GetDbContextType(Type dbContextType); |
|||
|
|||
Task<Type> GetDbContextTypeAsync(Type dbContextType); |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.MongoDB; |
|||
|
|||
public interface IMongoDbContextTypeProvider |
|||
{ |
|||
Type GetDbContextType(Type dbContextType); |
|||
|
|||
Task<Type> GetDbContextTypeAsync(Type dbContextType); |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.MongoDB; |
|||
|
|||
public class MongoDbContextTypeProvider : IMongoDbContextTypeProvider, ITransientDependency |
|||
{ |
|||
private readonly AbpMongoDbContextOptions _options; |
|||
|
|||
public MongoDbContextTypeProvider(IOptions<AbpMongoDbContextOptions> options) |
|||
{ |
|||
_options = options.Value; |
|||
} |
|||
|
|||
public Type GetDbContextType(Type dbContextType) |
|||
{ |
|||
return _options.GetReplacedTypeOrSelf(dbContextType); |
|||
} |
|||
|
|||
public virtual Task<Type> GetDbContextTypeAsync(Type dbContextType) |
|||
{ |
|||
return Task.FromResult(_options.GetReplacedTypeOrSelf(dbContextType)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue