usingSystem;usingSystem.Data.Objects;usingSystem.Linq;namespaceoutofmemory.codes{/// <summary> ///Adds extension Methods to the<see cref= "Iqueryable{t}"/>class. /// </summary> Public Static classQueryableextender {/// <summary> ///specifies the related objects to include in the query results. /// </summary> /// <typeparam name= "T" ><see cref= "Type"/>of query to extend.</typeparam> /// <param name= "This" >The query to extend.</param> /// <param name= "path" > ///dot-separated List of related objects to return in the query results. /// </param> /// <returns> ///A New<see cref= "Iqueryable{t}"/>With the defined query path. /// </returns> /// <exception cref= "ArgumentNullException" > ///The parameter<paramref name= "path"/>is null. /// </exception> /// <exception cref= "ArgumentException" > ///The parameter<paramref name= "path"/>Is empty. /// </exception> Public StaticIqueryable<t> include<t> ( ThisIqueryable<t> @this,stringpath) { varObjectQuery = @this asObjectquery<t>; if(ObjectQuery! =NULL) { returnobjectquery.include (path); } return@this; } }}
Dbextensions. Include<t> Method (IQueryable<t;, String)
Https://msdn.microsoft.com/en-us/library/system.data.entity.dbextensions.include
Namespace: System.Data.Entity
Assembly: EntityFramework (in EntityFramework.dll)
C # Adds an include extension method to IQueryable