Maybe it would be nice to have a Default DbContextFactory, that gives the client the possibility to set the connection string for projects that have multiple DBs.
namespace Mehdime.Entity
{
public class DbContextFactoryDefault : IDbContextFactory
{
string _connection;
public DbContextFactoryDefault(string connection_)
{
_connection = connection_;
}
public TDbContext CreateDbContext<TDbContext>() where TDbContext : DbContext
{
object[] arguments = new object[1] { (object)_connection };
return (TDbContext)Activator.CreateInstance(typeof(TDbContext), arguments);
}
}
}
Use:
Dim dbContextScopeFactory = New DbContextScopeFactory(New DbContextFactoryDefault("testCon"))
Dim ambientDbContextLocator = New AmbientDbContextLocator()
Maybe it would be nice to have a Default DbContextFactory, that gives the client the possibility to set the connection string for projects that have multiple DBs.
Use:
Regards.