mirror of https://github.com/abpframework/abp.git
6 changed files with 71 additions and 5 deletions
@ -0,0 +1,16 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.DependencyInjection.Extensions; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Repositories.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public class AbpEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
//TODO: This will be changed!
|
|||
services.TryAddTransient(typeof(IDbContextProvider<>), typeof(DefaultDbContextProvider<>)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.Repositories.EntityFrameworkCore |
|||
{ |
|||
public class DefaultDbContextProvider<TDbContext> : IDbContextProvider<TDbContext> |
|||
where TDbContext : AbpDbContext<TDbContext> |
|||
{ |
|||
private readonly TDbContext _dbContext; |
|||
|
|||
public DefaultDbContextProvider(TDbContext dbContext) |
|||
{ |
|||
_dbContext = dbContext; |
|||
} |
|||
|
|||
public TDbContext GetDbContext() |
|||
{ |
|||
return _dbContext; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.Repositories.EntityFrameworkCore |
|||
{ |
|||
public interface IDbContextProvider<out TDbContext> |
|||
where TDbContext : AbpDbContext<TDbContext> |
|||
{ |
|||
TDbContext GetDbContext(); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Data |
|||
{ |
|||
public interface IConnectionInfoResolver |
|||
{ |
|||
ConnectionInfo Resolve(); |
|||
} |
|||
|
|||
public class ConnectionInfo |
|||
{ |
|||
public string ConnectionString { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue