WCF learning journey-Example 2 (28th) and Example 3

Source: Internet
Author: User

WCF learning journey-Example 2 (28th) and Example 3
Going on to the WCF learning journey-one of the third examples)

 

5. Install the Entity Framework

1) Use NuGet to download the latest Entity Framework 6.1.3. In Solution Explorer, right-click the project BookMgr. Model and choose manage NuGet packages from the shortcut menu to open the NuGet package management interface. For example. 2) Search for Entity in the NuGet package management interface, find the latest Entity Framework, and click Install. For example. 3) after the installation is complete, as shown in.

Step 2: Create an Object Data Model
  1. Right-click Solution Explorer, click the "BookMgr. Model" project, and select "Add-" to create a new item from the shortcut menu ..." 2. In the "Add new project" dialog box, select the "data" node and select the "ADO. NET Object Data Model" item.

    3. In the "name" text box, enter BookModel and select the "add" button.

    4. In the Object Data Model Wizard, on the select model content page, select "EF designer from the Database", and then select the next button. 5. On the "select your data connection" Page, Perform one of the following steps:

    • If the drop-down list contains data connections to the Test sample database, select this connection.
    • Or select the "New Connection" button to configure the new data connection. For example. 6. In the "Connection Properties" dialog box, select the corresponding database server, enter the user name and password, and select the database to be used. For example.

      7. If the database requires a password, select "Yes, include sensitive data in the connection string" and then select "Next. You can observe the differences between the data connections in the two charts below the timeline.

      • 8. On the "select database object" Page, expand the "table" node, select the "customer" check box, and then select the "finish" button.

      The object model diagram is displayed, and the BookModel. edmx file is added to the project. 9. The final result is as follows.

      10. The Code is as follows.

      // User entity // ---------------------------------------------------------------------------------- // <auto-generated> // This code has been generated from the template. //// Manual modification of this file may cause unexpected behavior of the application. // If the code is re-generated, the manual changes to the file will be overwritten. // </Auto-generated> // -------------------------------------------------------------------------------- namespace BookMgr. model {using System; using System. collections. generic; public partial class Books {public int BookID {get; set;} public string Category {get; set;} public string Name {get; set;} public int Numberofcopies {get; set;} public int AuthorID {get; set;} public decimal Price {get; set;} public System. dateTime PublishDate {get; set;} public string Rating {get; set ;}}}

       

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.