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 modeling techniques


So far, we have covered many straightforward scenarios that one can easily model with Entity Framework to create database structures. All of them are mapped to one table with scalar values to a class with a matching set of properties. There are use cases when this approach does not work quite as well, and we will walk through a functionality in Entity Framework that supports more complex modeling techniques.

Complex types

Complex types are classes that map to a subset of columns in a table in the database. They are similar to entity classes, except that they do not contain key fields and do not directly map to an entire table. Complex types are helpful when we have the same set of properties that are common to multiple entities. Another use case is when we want to group some properties, in order to provide a clear semantic meaning to such a group of properties. By introducing a complex type into our modeling workflow, we provide more consistency for database structures...