Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
renawolford6 committed Sep 7, 2017
1 parent 8b073d8 commit cd56803
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
@@ -1,3 +1,4 @@
using System.Data.Common;
using Microsoft.EntityFrameworkCore;

namespace AbpCompanyName.AbpProjectName.EntityFrameworkCore
Expand All @@ -8,5 +9,10 @@ public static void Configure(DbContextOptionsBuilder<AbpProjectNameDbContext> bu
{
builder.UseSqlServer(connectionString);
}

public static void Configure(DbContextOptionsBuilder<AbpProjectNameDbContext> builder, DbConnection connection)
{
builder.UseSqlServer(connection);
}
}
}
Expand Up @@ -16,14 +16,20 @@ public class AbpProjectNameEntityFrameworkModule : AbpModule

public bool SkipDbSeed { get; set; }


public override void PreInitialize()
{
if (!SkipDbContextRegistration)
{
Configuration.Modules.AbpEfCore().AddDbContext<AbpProjectNameDbContext>(configuration =>
Configuration.Modules.AbpEfCore().AddDbContext<AbpProjectNameDbContext>(options =>
{
AbpProjectNameDbContextConfigurer.Configure(configuration.DbContextOptions, configuration.ConnectionString);
if (options.ExistingConnection != null)
{
AbpProjectNameDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
AbpProjectNameDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
}
}
Expand Down

0 comments on commit cd56803

Please sign in to comment.