public static IIncludeQuery <TEntity, TNewProperty> Include <TEntity, TPreviousProperty, TNewProperty>(this IIncludeQuery <TEntity, TPreviousProperty> query, Expression <Func <TEntity, TNewProperty> > selector) { query.Visitor.Visit(node: selector); var includeQuery = new IncludeQuery <TEntity, TNewProperty>(pathMap: query.PathMap); query.PathMap[key : includeQuery] = query.Visitor.Path; return(includeQuery); }
public IncludeQuery <TEntity, TProperty> Include <TProperty>(Expression <Func <TEntity, TProperty> > selector) { var visitor = new IncludeVisitor(); visitor.Visit(node: selector); var pathMap = new Dictionary <IIncludeQuery, string>(); var query = new IncludeQuery <TEntity, TProperty>(pathMap: pathMap); if (!string.IsNullOrEmpty(value: visitor.Path)) { pathMap[key : query] = visitor.Path; } return(query); }
public IncludeQuery <TEntity, TProperty> Include <TProperty>(Expression <Func <TEntity, TProperty> > selector) { IncludeVisitor visitor = new IncludeVisitor(); visitor.Visit(selector); Dictionary <IIncludeQuery, string> pathMap = new Dictionary <IIncludeQuery, string>(); IncludeQuery <TEntity, TProperty> query = new IncludeQuery <TEntity, TProperty>(pathMap); if (!string.IsNullOrEmpty(visitor.Path)) { pathMap[query] = visitor.Path; } return(query); }
public static IIncludeQuery <TEntity, TNewProperty> ThenInclude <TEntity, TPreviousProperty, TNewProperty>(this IIncludeQuery <TEntity, IEnumerable <TPreviousProperty> > query, Expression <Func <TPreviousProperty, TNewProperty> > selector) { query.Visitor.Visit(node: selector); // If the visitor did not generated a path, return a new IncludeQuery with an unmodified PathMap. if (string.IsNullOrEmpty(value: query.Visitor.Path)) { return(new IncludeQuery <TEntity, TNewProperty>(pathMap: query.PathMap)); } Dictionary <IIncludeQuery, string> pathMap = query.PathMap; string existingPath = pathMap[key : query]; pathMap.Remove(key: query); var includeQuery = new IncludeQuery <TEntity, TNewProperty>(pathMap: query.PathMap); pathMap[key : includeQuery] = $"{existingPath}.{query.Visitor.Path}"; return(includeQuery); }
public static IIncludeQuery <TEntity, TNewProperty> ThenInclude <TEntity, TPreviousProperty, TNewProperty>( this IIncludeQuery <TEntity, IEnumerable <TPreviousProperty> > query, Expression <Func <TPreviousProperty, TNewProperty> > selector) { query.Visitor.Visit(selector); if (string.IsNullOrEmpty(query.Visitor.Path)) { return(new IncludeQuery <TEntity, TNewProperty>(query.PathMap)); } var pathMap = query.PathMap; var existingPath = pathMap[query]; pathMap.Remove(query); var includeQuery = new IncludeQuery <TEntity, TNewProperty>(query.PathMap); pathMap[includeQuery] = $"{existingPath}.{query.Visitor.Path}"; return(includeQuery); }
public static IIncludeQuery <TEntity, TNewProperty> ThenInclude <TEntity, TPreviousProperty, TNewProperty>( this IIncludeQuery <TEntity, TPreviousProperty> query, Expression <Func <TPreviousProperty, TNewProperty> > selector) { query.Visitor.Visit(selector); // If the visitor did not generated a path, return a new IncludeQuery with an unmodified PathMap. if (string.IsNullOrEmpty(query.Visitor.Path)) { return(new IncludeQuery <TEntity, TNewProperty>(query.PathMap)); } var pathMap = query.PathMap; var existingPath = pathMap[query]; pathMap.Remove(query); var includeQuery = new IncludeQuery <TEntity, TNewProperty>(query.PathMap); pathMap[includeQuery] = $"{existingPath}.{query.Visitor.Path}"; return(includeQuery); }