Created
December 5, 2014 01:14
-
-
Save danielmackay/ec251db1d2049b3dadee to your computer and use it in GitHub Desktop.
Type safe extension method that allows you to pass a list of expressions to determine navigation properties for EF to load. #ef
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
| internal static class QueryableExt | |
| { | |
| public static IQueryable<T> IncludeMultiple<T>(this IQueryable<T> query, params Expression<Func<T, object>>[] includes) where T : class | |
| { | |
| if (includes == null) | |
| return query; | |
| foreach (var include in includes) | |
| { | |
| query = query.Include(include); | |
| } | |
| return query; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment