Asp.net+sqlserver+entityframework (Summary)

Source: Internet
Author: User

A summary of the application under Asp.net,sqlserver,entityframework

Body:

1. Summarize the use of EntityFrameWork5.0

<1> Paging Note: the Where () extension method needs to be written before using Skip (). Take () for data acquisition, which will result in incomplete data acquisition (partially filtered out)

<2> Infinite Loop processing when JSON serialization of table entities with foreign key relationships

Problem Analysis: Student table and Class table, a class has multiple student,sclassid as foreign key, when serializing student table (Json) will report an infinite loop error, Because the class table is found in student through SCLASSID, the navigation property of a set in the class table holds the student information and returns to student, resulting in an infinite loop

Solve the problem:

First: Turn off lazy loading:

The second type: Select the data for this table, and do not navigate the columns of the property.

<3> using lazy Loading

Using lazy loading, when appropriate, is a good way to optimize performance, which is generally enabled by default.

<4> do not track queries

Reduces container-to-entity (collection) management, which facilitates performance:

<5> Multi-Table connection query

<6> Optimistic concurrency control

Repeater controls under 2.asp.net and paging controls that support multiple databases AspNetPager.dll

<1> use Repeater to implement the effects of the JQ (Ajax) template to load a repeating data table in one format:

<2> with AspNetPager.dll for fast Paging

To add a pager button event for a paging control:

<3> for formatting under Repeater control items:

The first method: using callbacks:

The second method: Use the ternary operator:

<td><%# Int. Parse (Eval ("Price"). ToString ()) > 3600? "<a>#</a>": Eval ("Price"). ToString ()%></td>

<4> clear the contents of Request.QueryString:

Summarize:

The use of some of the control of ASP can also achieve a lot of effect function;

EF rapid development;

end!

Asp.net+sqlserver+entityframework (Summary)

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.