Entity Framework 4.0 and WCF Data Services 4.0 in Visual studio-visual Studio 2010

Source: Internet
Author: User
Tags new features scalar silverlight visual studio 2010

In many of the new improvements, Visual Studio 2010 introduced the Long-awaited Entity Framework 4.0 and WCF Data Services 4.0 (formerly known as ado.net Data Services), which combined to simplify the way you build data models, work with data, and generate data.

The Entity Framework 4.0 (EF 4.0) is dedicated to enabling and simplifying two major scenarios: domain-centric application development and traditional data-centric "data-based form design." It introduces features such as model priority development, which allows you to create models and generate custom T-SQL for you, support for persistent transparency, foreign keys, deferred loading, and custom code generation for entities.

WCF Data Services 4.0 is dedicated to updating Open Data Protocol (odata.org) and its new features, including bidirectional data binding, row count, server-driven paging for Windows presentation Foundation (WPF) and Silverlight , enhanced binary large object support, and support for projections.

I will use a simple blog application (myblog) to explore new features in the EF and WCF data Services and how they work together to simplify the way in which data models are built and data is used. This sample application will contain a asp.net Web application that provides a read-only view of the blog post, and a Silverlight blog Administrator Client that allows the blog owner to edit articles. At the beginning of the application, I will first create an Entity Data Model (EDM) using the model, and then build the database and the code to interact with the database. This sample will also use the Ado.net Data Service update for Silverlight 3 CTP 3.

Getting Started with EF 4.0

I'll explore the ASP.net Web application project first. To start using EF, I use the Add New Item wizard to add a ado.net EDM and select an empty model that I also call Blogmodel. By right-clicking the empty designer surface and selecting properties, you can see the default entity container name, which is blogmodelcontainer in this example. First, I'll change the name to Blogcontext, and then I'll create the model.

MyBlog requires three entities, I name them Blog, Post and Tag, as shown in Figure 1. To create these entities, I drag an entity from the toolbox to the design surface, and then right-click and select Properties to edit the entity properties. On each of these entities, I will also need some scalar properties (right-click the entity and choose Add | Scalar property ").

Figure 1 Blog, Post and Tag entities and associated property settings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.