04.07.2013 Views

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Code First: Using <strong>Entity</strong> <strong>Framework</strong> with No<br />

Model at All<br />

The <strong>Entity</strong> <strong>Framework</strong> supports one additional scenario, and that is one which relies<br />

solely on classes and doesn’t include the <strong>Entity</strong> <strong>Framework</strong> metadata. There is no EDMX<br />

file at design time, and there are no physical CSDL, MSL, or SSL files to work with at<br />

runtime. This feature is called code-first development. It is not included in .NET 4.0 and<br />

Visual Studio 2010, but it is part of the <strong>Entity</strong> <strong>Framework</strong> Feature CTP that is currently<br />

released as an “out of band” addition to <strong>Entity</strong> <strong>Framework</strong>. Chapter 23 contains a<br />

preview of using code first for your <strong>Entity</strong> <strong>Framework</strong>-based applications.<br />

Summary<br />

In this chapter, you learned about one of the most important features added to <strong>Entity</strong><br />

<strong>Framework</strong> in .NET 4.0: support for classes that do not inherit from the<br />

<strong>Entity</strong>Object class. You learned how to create simple classes that will still benefit<br />

from the <strong>Entity</strong> <strong>Framework</strong>’s modeling, querying, change tracking, and relationship<br />

management features. The ObjectContext can manage these classes by taking<br />

snapshots of their current state or by using proxy <strong>Entity</strong>Objects to provide change<br />

notification and relationship management on the fly. In later chapters, you will see POCO<br />

classes used in application solutions. You will also see how they fit into more agile<br />

software architectures and can be part of good testing practices.<br />

In the next chapter, we will step back into the mode of creating practical solutions with<br />

<strong>Entity</strong> <strong>Framework</strong> as we explore some simple ways to use entities in ASP.NET<br />

applications.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!