Sometimes, we have a use case where we want to add Entity Framework migrations to an existing database so that we can move from one way to handle schema changes to the migrations API. Of course, since our database is already in production, we need to let migrations know that we are starting with a known state. This is quite easy to do with another parameter to the Add-Migration
commandlet: –IgnoreChanges
. When we issue this command, Entity Framework will create an empty migration. It will assume that your model defined by context and entities are compatible with our database. Once you update the database by running this migration, no schema changes will take place, but a new row will be added to the _MigrationHistory
table for this initial migration. Once this is accomplished, we can safely switch to the Entity Framework migration API to maintain schema changes from that point on.
Code-First Development with Entity Framework
By :
Code-First Development with Entity Framework
By:
Overview of this book
<p>Entity Framework Code-First enables developers to read and write data in a relational database system using C# or VB.NET. It is Microsoft's answer to demand for an ORM from .NET developers.</p>
<p>This book will help you acquire the necessary skills to program your applications using Entity Framework. You will start with database configuration and learn how to write classes that define the database structure. You will see how LINQ can be used with Entity Framework to give you access to stored data. You will then learn how to use Entity Framework to persist information in a Relational Database Management System. You will also see how you can benefit from writing ORM-based .NET code. Finally, you will learn how Entity Framework can help you to solve database deployment problems using migrations.</p>
Table of Contents (15 chapters)
Code-First Development with Entity Framework
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Introducing Entity Framework
Your First Entity Framework Application
Defining the Database Structure
Querying, Inserting, Updating, and Deleting Data
Advanced Modeling and Querying Techniques
Working with Views, Stored Procedures, the Asynchronous API, and Concurrency
Database Migrations and Additional Features
Answers to Self-test Questions
Index
Customer Reviews