The best way should be using new MigrateDatabaseToLatestVersion
initializer.
Database.SetInitializer<YourContext>(
new MigrateDatabaseToLatestVersion<YourContext, YourMigrationsConfig>());
Database.Initialize(false);
More Related Contents:
- Using Entity Framework (code first) migrations in production
- Entity Framework and Connection Pooling
- Entity Framework vs LINQ to SQL
- Like Operator in Entity Framework?
- Fake DbContext of Entity Framework 4.1 to Test
- How can I query for null values in entity framework?
- Entity Framework: table without primary key
- .NET Entity Framework and transactions
- Can you use Microsoft Entity Framework with Oracle? [closed]
- How do I enable EF migrations for multiple contexts to separate databases?
- “Items collection must be empty before using ItemsSource.”
- Does Entity Framework support parallel async queries? [duplicate]
- How to make Entity Framework Data Context Readonly
- Is is possible to check if an object is already attached to a data context in Entity Framework?
- The repository itself is not usually tested?
- What are Navigation Properties in Entity Framework for?
- LINQ to Entities does not recognize the method Int32 get_Item(Int32)
- How to set default value for POCO’s in EF CF?
- Can’t find ADO.net Entity Data Model template in VS2017
- Start a Task in the Form Shown event
- Entity Framework is Too Slow. What are my options? [closed]
- Where to run a duplicate check for an entity
- entity framework Unable to load the specified metadata resource [duplicate]
- How can I configure Entity Framework to automatically trim values retrieved for specific columns mapped to char(N) fields?
- The model backing the ‘ApplicationDbContext’ context has changed since the database was created
- Entity Framework Find vs. Where
- Best way to incrementally seed data in Entity Framework 4.3
- Do you think it’s advantageous to switch to Entity Framework? [closed]
- ‘ObjectContext’ vs ‘DbContext’ in Entity Framework
- Using Entity Framework entities as business objects?