Created
June 9, 2017 17:50
-
-
Save smitpatel/634ea12e608682282e57ec53ed5abc4f to your computer and use it in GitHub Desktop.
New include overloads to support including navigations using lambda on derived types while querying base type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EntityFrameworkQuerybleExtensions | |
{ | |
#region Current | |
public static IIncludableQueryable<TEntity, TProperty> Include<TEntity, TProperty>( | |
this IQueryable<TEntity> source, | |
Expression<Func<TEntity, TProperty>> navigationPropertyPath) | |
where TEntity : class | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
public static IIncludableQueryable<TEntity, TProperty> ThenInclude<TEntity, TPreviousProperty, TProperty>( | |
this IIncludableQueryable<TEntity, TPreviousProperty> source, | |
Expression<Func<TPreviousProperty, TProperty>> navigationPropertyPath) where TEntity : class | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
public static IIncludableQueryable<TEntity, TProperty> ThenInclude<TEntity, TPreviousProperty, TProperty>( | |
this IIncludableQueryable<TEntity, ICollection<TPreviousProperty>> source, | |
Expression<Func<TPreviousProperty, TProperty>> navigationPropertyPath) where TEntity : class | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
#endregion | |
#region NewOverloads | |
public static IIncludableQueryable<TEntity, TProperty> Include<TEntity, TDerived, TProperty>( | |
this IQueryable<TEntity> source, | |
Expression<Func<TDerived, TProperty>> navigationPropertyPath) | |
where TEntity : class | |
where TDerived : TEntity | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
public static IIncludableQueryable<TEntity, TProperty> ThenInclude<TEntity, TPreviousProperty, TDerived, TProperty>( | |
this IIncludableQueryable<TEntity, TPreviousProperty> source, | |
Expression<Func<TDerived, TProperty>> navigationPropertyPath) where TEntity : class where TDerived : TPreviousProperty | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
public static IIncludableQueryable<TEntity, TProperty> ThenInclude<TEntity, TPreviousProperty, TDerived, TProperty>( | |
this IIncludableQueryable<TEntity, ICollection<TPreviousProperty>> source, | |
Expression<Func<TDerived, TProperty>> navigationPropertyPath) where TEntity : class where TDerived : TPreviousProperty | |
{ | |
return default(IIncludableQueryable<TEntity, TProperty>); | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@smitpatel, collection navigations are actually of type
IEnumerable<TPreviousProperty>
rather thanICollection<TPreviousProperty>
in the actual code, correct?