Created
February 16, 2017 13:30
-
-
Save alexeyzimarev/34542645ff8f27550d0679c7cb696111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MassTransit.EntityFrameworkIntegration | |
{ | |
using System.Data.Common; | |
using System.Data.Entity; | |
using System.Data.Entity.Core.Objects; | |
using System.Data.Entity.Infrastructure; | |
using System.Reflection; | |
public class AssemblyScanningSagaDbContext : DbContext | |
{ | |
readonly Assembly _mappingAssembly; | |
public AssemblyScanningSagaDbContext(Assembly mappingAssembly, string nameOrConnectionString) | |
: base(nameOrConnectionString) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
public AssemblyScanningSagaDbContext(Assembly mappingAssembly, ObjectContext objectContext, bool dbContextOwnsObjectContext) | |
: base(objectContext, dbContextOwnsObjectContext) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
public AssemblyScanningSagaDbContext(Assembly mappingAssembly, DbConnection existingConnection, bool contextOwnsConnection) | |
: base(existingConnection, contextOwnsConnection) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
public AssemblyScanningSagaDbContext(Assembly mappingAssembly, string nameOrConnectionString, DbCompiledModel model) | |
: base(nameOrConnectionString, model) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
public AssemblyScanningSagaDbContext(Assembly mappingAssembly, DbConnection existingConnection, DbCompiledModel model, bool contextOwnsConnection) | |
: base(existingConnection, model, contextOwnsConnection) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
protected AssemblyScanningSagaDbContext(Assembly mappingAssembly) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
protected AssemblyScanningSagaDbContext(Assembly mappingAssembly, DbCompiledModel model) | |
: base(model) | |
{ | |
_mappingAssembly = mappingAssembly; | |
} | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) => | |
modelBuilder.Configurations.AddFromAssembly(_mappingAssembly); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment