About how to batch modify attributes of entities created in the database First mode of Entity Framework,

Source: Internet
Author: User

About how to batch modify attributes of entities created in the database First mode of Entity Framework,

Entity Framework uses the DB First mode to create objects, which is easy and convenient. It is no problem to modify the number of created objects in a small number. However, if there are many created entities, for example, if there are more than 10 objects that involve modification, it is no longer convenient to use a visual editor. Instead, entity data should be presented in XML format, then we use our frequently-used editing methods to copy, paste, and cut to quickly implement batch modification. The following describes the batch modification method:

1. Find the object created by Entity Framework in DB First mode. The object ends with. edmx, as shown in:

2. Select the specified edmx file, right-click it, and select "open mode" from the pop-up menu, as shown in:

3. In the pop-up list, select any method that can be edited in XML, and click OK to open the edmx file in XML format, as shown in:

The displayed result is as follows:

From the XML open effect and the connectionString generated, we can know that after ef db first is created successfully, three parts of the content file will be generated :*. SSDL (),*. CSDL ,*. MSL, each of which has its own functions:

SSDL: defines some attributes in the database (for example, the length of a field)

CSDL: define business entities

MSL: defines the ing between business entities and database objects.

We can find and modify or replace the corresponding data as needed, and then save it.

Common batch modification scenarios are as follows:

1. Modify the Schema of the data. This can be modified in SSDL. If you do not modify the Schema in XML format, you must delete all and re-generate the objects;

2. Modify the information of an attribute, such as the name and type;

3. Modify the ing between entities and database fields;

 

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.