|
|
@ -1,20 +1,26 @@ |
|
|
using JetBrains.Annotations; |
|
|
using System; |
|
|
|
|
|
using JetBrains.Annotations; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
using Volo.DependencyInjection; |
|
|
|
|
|
|
|
|
namespace Volo.Abp.EntityFrameworkCore.DependencyInjection |
|
|
namespace Volo.Abp.EntityFrameworkCore.DependencyInjection |
|
|
{ |
|
|
{ |
|
|
public class AbpDbContextConfigurationContext |
|
|
public class AbpDbContextConfigurationContext : IServiceProviderAccessor |
|
|
{ |
|
|
{ |
|
|
|
|
|
public IServiceProvider ServiceProvider { get; } |
|
|
|
|
|
|
|
|
public string ConnectionString { get; } |
|
|
public string ConnectionString { get; } |
|
|
|
|
|
|
|
|
public string ConnectionStringName { get; } |
|
|
public string ConnectionStringName { get; } |
|
|
|
|
|
|
|
|
public DbContextOptionsBuilder DbContextOptions { get; protected set; } |
|
|
public DbContextOptionsBuilder DbContextOptions { get; protected set; } |
|
|
|
|
|
|
|
|
public AbpDbContextConfigurationContext(string connectionString, [CanBeNull] string connectionStringName) |
|
|
public AbpDbContextConfigurationContext(string connectionString, [CanBeNull] string connectionStringName, [NotNull] IServiceProvider serviceProvider) |
|
|
{ |
|
|
{ |
|
|
ConnectionString = connectionString; |
|
|
ConnectionString = connectionString; |
|
|
ConnectionStringName = connectionStringName; |
|
|
ConnectionStringName = connectionStringName; |
|
|
|
|
|
ServiceProvider = serviceProvider; |
|
|
|
|
|
|
|
|
DbContextOptions = new DbContextOptionsBuilder(); |
|
|
DbContextOptions = new DbContextOptionsBuilder(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -24,8 +30,8 @@ namespace Volo.Abp.EntityFrameworkCore.DependencyInjection |
|
|
{ |
|
|
{ |
|
|
public new DbContextOptionsBuilder<TDbContext> DbContextOptions => (DbContextOptionsBuilder<TDbContext>)base.DbContextOptions; |
|
|
public new DbContextOptionsBuilder<TDbContext> DbContextOptions => (DbContextOptionsBuilder<TDbContext>)base.DbContextOptions; |
|
|
|
|
|
|
|
|
public AbpDbContextConfigurationContext(string connectionString, [CanBeNull] string connectionStringName) |
|
|
public AbpDbContextConfigurationContext(string connectionString, [CanBeNull] string connectionStringName, [NotNull] IServiceProvider serviceProvider) |
|
|
: base(connectionString, connectionStringName) |
|
|
: base(connectionString, connectionStringName, serviceProvider) |
|
|
{ |
|
|
{ |
|
|
base.DbContextOptions = new DbContextOptionsBuilder<TDbContext>(); |
|
|
base.DbContextOptions = new DbContextOptionsBuilder<TDbContext>(); |
|
|
} |
|
|
} |
|
|
|