Entity Framework : Change connection string at runtime
Assuming there is an ASP.NET MVC application that uses Entity Framework 6 with code-first approach and StructureMap as IoC. Also It uses Unit Of Work pattern. Here are the codes : Domain Class public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } } IUnitOfWork and DbContext : public interface IUnitOfWork { IDbSet<TEntity> Set<TEntity>() where TEntity : class; int SaveChanges(); } public class Sample07Context : DbContext, IUnitOfWork { public DbSet<Product> Products { set; get; } #region IUnitOfWork Members public new IDbSet