From: http://www.cnblogs.com/mbailing/archive/2012/07/16/2593368.html
Tips for using ef4.1/4.3
(1) Multi-table join query statement:
VaR query = (from m in context. dic_propertyclassdef.include ("dic_propertytypedef ")
. Include ("dic_propertytypedef.dic_propertyvaluedef ")
. Include ("dic_propertytypedef.dic_propertyoptvaluedef ")
This is a multi-table join query statement. You can keep incude. However, it is recommended that you use SQL or stored procedures for complicated services.
(2) The in statement in ef4.1/4.3:
VaR query = Entities. Where (P => IDs. Contains (P. ID ));
IDS is the ID column you passed in this sentence. It can be an array or a wildcard (list <int>)
(3) paging in EF
Query. orderbydescending (r => r. propid). Skip (startrowindex). Take (maximumrows). tolist ();
Startrowindex is the starting index and the number of maximumrows to query. For example, startrowindex = 0 and maximumrows = 10 are 10 records starting from 0.
EF distribution must be used with orderbydescending.