set the Database.SetInitializer to null.
public class DatabaseContext: DbContext
{
//the base accepts the name of the connection string provided in the web.config as a parameter
public DatabaseContext()
: base("DatabaseContext")
{
//disable initializer
Database.SetInitializer<DatabaseContext>(null);
}
Related Contents:
- Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project
- Unique Constraint in Entity Framework Code First
- in entity framework code first, how to use KeyAttribute on multiple columns
- Nullable property to entity field, Entity Framework through Code First
- Entity Framework Code First – No Detach() method on DbContext
- How to ignore a property when using Entity Framework Code First [duplicate]
- How can I get my database to seed using Entity Framework CodeFirst?
- Why is my DbContext DbSet null?
- How do I remove underscore of foreign key fields in code first by convention
- Code-first vs Model/Database-first [closed]
- No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’
- Reset Entity-Framework Migrations
- Validation failed for one or more entities while saving changes to SQL Server Database using Entity Framework
- How to pass parameters to the DbContext.Database.ExecuteSqlCommand method?
- Entity Framework rollback and remove bad migration
- EF Code First “Invalid column name ‘Discriminator'” but no inheritance
- Generate full SQL script from EF 5 Code First Migrations
- Debug code-first Entity Framework migration codes
- Entity framework code-first null foreign key
- Entity Framework and SQL Server View
- How should I edit an Entity Framework connection string?
- add-migration causing a “Could not load assembly” error
- How to create index in Entity Framework 6.2 with fluent configuration
- Check if there are any pending changes to be saved
- Entity Framework Vs Stored Procedures – Performance Measure
- What goes into DbContextOptions when invoking a new DbContext?
- How to add foreign key relationship in Entity Framework?
- Should I enable or disable dynamic proxies with entity framework 4.1 and MVC3?
- MetadataException when using Entity Framework Entity Connection [duplicate]
- Entity Framework mergeoption notracking bad performance
- Entity Framework – Why explicitly set entity state to modified?
- C# Code-First migration, up/down?
- EntityFramework Core automatic migrations
- How do you update an edmx file with database changes?
- Entity Framework. View return duplicate records
- Entityframework Join using join method and lambdas
- EF Code First giving me error Cannot insert explicit value for identity column in table ‘People’ when IDENTITY_INSERT is set to OFF. [duplicate]
- ASP.NET MVC3 and Entity Framework Code first architecture
- Entity Framework: Re-finding objects recently added to context
- What is the best practice in EF Core for using parallel async calls with an Injected DbContext?
- Entity framework – “Problem in mapping fragments”-error. Help me understand the explanations of this error
- Entity Framework 6 Code First – Is Repository Implementation a Good One?
- How to implement IDbContextFactory for use with Entity Framework data migrations
- Create a Dropdown List for MVC3 using Entity Framework (.edmx Model) & Razor Views && Insert A Database Record to Multiple Tables
- Create a Dropdown List for MVC3 using Entity Framework (.edmx Model) & Razor Views && Insert A Database Record to Multiple Tables
- How do I map a char property using the Entity Framework 4.1 “code only” fluent API?
- What specific issue does the repository pattern solve?
- An error occurred while accessing the Microsoft.Extensions.Hosting services when do first migrations
- Error 6002: The table/view does not have a primary key defined
- Entity Framework options to map list of strings or list of int (List)