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

Advanced querying techniques


We talked about querying techniques in previous chapters. The topic of data retrieval is very extensive and requires developers to be thoroughly familiar with everything LINQ has to offer, in order to address scenarios that come up on a daily basis. In this chapter, we will cover many advanced topics. We want to make sure that developers are prepared for the vast majority of tasks they do daily, but some rarely encountered scenarios may not be addressed in this book.

Projections

Projections refer to a process of retrieving a subset of columns from one or more tables in a single query instead of all the columns, as we saw earlier in this book. Projections are very important from the perspective of efficiency and performance. If we only need to present the first and last names of a person to a user of our software, we have no reason to get all the columns from the Person table. Now we are faced with a question. How do we represent this data from the object perspective...