

Migrations should be thoroughly tested before being applied to production data. Detailed examination and testing of generated migrations.For more information, see Applying Migrations. Use staging to facilitate recovery from fatal errors during migration. Plan out how migrations are going to be applied during deployment doing it at application start can suffer from concurrency issues and requires higher permissions than necessary for normal operation. Prepare contingencies for common failure scenarios such as version rollback, fallback servers, scale-out and load balancing, DoS mitigation, and data backups. For example, appropriate logging configuration, query tags, and Application Insights. Make sure logging and diagnostics are sufficient and usable.Security review: For example, handling of connection strings and other secrets, database permissions for non-deployment operation, input validation for raw SQL, encryption for sensitive data.For example, multiple collections Includes, heavy use of lazy loading, conditional queries on non-indexed columns, massive updates and inserts with store-generated values, lack of concurrency handling, large models, inadequate cache policy. The naïve usage of some features doesn't scale well. Performance and stress testing with representative loads.These dependencies can affect EF Core in unexpected ways. For example, adding or upgrading frameworks like ASP.NET Core, OData, or AutoMapper. Catch breaking changes when upgrading EF Core and other dependencies.Find issues in the app that only show up when using a specific versions or edition of the database server.Functional and integration testing: It's important to replicate the production environment as closely as possible to:.For example, knowledge of primary and foreign keys, constraints, indexes, normalization, DML and DDL statements, data types, profiling, etc. Intermediate-level knowledge or higher of the underlying database server is essential to architect, debug, profile, and migrate data in high performance production apps.While EF Core is good at abstracting many programming details, there are some best practices applicable to any O/RM that help to avoid common pitfalls in production apps:

using (var db = new BloggingContext())ĭata is created, deleted, and modified in the database using instances of your entity classes. Instances of your entity classes are retrieved from the database using Language Integrated Query (LINQ). Protected override void OnConfiguring(DbContextOptionsBuilder class Blog Migrations allow evolving the database as the model changes. Once a model is created, use EF Migrations to create a database from the model.

Icollections lite vs collections code#
