Book Image

Code-First Development with Entity Framework

By : Sergey Barskiy
Book Image

Code-First Development with Entity Framework

By: Sergey Barskiy

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
Index

The basics of LINQ


Language INtegrated Query (LINQ) is the language that we use with Entity Framework to construct and execute queries against a database. A query is a statement that retrieves data from one or more tables. LINQ has many query implementations. At the most basic level, .NET includes LINQ in an object's functionality that allows you to query in-memory collections. LINQ to entities is typically the name that is used when talking about LINQ in relation to Entity Framework. This technology uses Entity Framework in conjunction with a provider for a specific RDBMS to convert LINQ statements to SQL queries. Entity Framework takes care of materialization; the process of converting the results of SQL queries into collections of .NET objects or individual objects.

When you use LINQ to entities queries, you will find out that the SQL is executed against the database when you enumerate the query results. Entity Framework converts LINQ queries to expression trees and then command trees...