Barefoot learning LINQ (041): Use the object relationship designer to modify the ing relationship

Source: Internet
Author: User

Demo Video: http://u.115.com/file/f2b86d8eab

Demonstration highlights
This Demo Video mainly describes how to use the object relation designer provided by Vs to establish the relationship between object classes.
Although this tool can automatically establish the relationship between entity classes and object classes in the object model based on the relationship between data tables. However, by default, the relationships it establishes appear to be one-to-multiple relationships. ^_^ In fact, the relationship types supported by LINQ to SQL are not limited. Therefore, sometimes you have to take the shot, but the tool alone is not enough.
In the object relationship designer, the relationship between object classes is usually represented by a dotted line with a black solid arrow. For example:

If you right-click the dotted line between two entity classes, you will find a menu item "Edit Association" in the pop-up menu. Click it to bring up a form similar to the following:

In this dialog box, you can set the attributes of the parent class and the Child class to be associated. It is really convenient!
However, if you want to make more modifications to the association relationship, you can go back to the attribute panel to make modifications. The attribute settings of associations are similar to the following:

The focus of this demonstration is the "base" setting item. Which is the base setting item? Show the arrow! After changing the vs version, it turns into English. Depressed! This setting contains two options: one-to-one and one-to-many.
The biggest impact of this base setting on the code is the type of the set attribute accessed by one party.
When it is set to a one-to-one relationship, the private variable type of the collection object stored by one party is entityref <tentity>; if it is set to a one-to-many relationship, it is entityset <tentity>.

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.