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)