public IEnumerable <dynamic> EagerLoad(IEnumerable <dynamic> models, dynamic options) { var ones = @" select * from {fromTable} where {primaryKey} in ({inClause})" .Replace("{fromTable}", Repository.TableName) .Replace("{primaryKey}", IdColumnOfParentTable) .Replace("{inClause}", InClause(models, PropertyContainingIdValue)); return(EagerLoadSingleForAll.Execute(models, Repository, MethodName, ones, (result, source) => result.GetMember(IdColumnOfParentTable) == source.GetMember(PropertyContainingIdValue))); }
public IEnumerable <dynamic> EagerLoad(IEnumerable <dynamic> models, dynamic options) { var xRefFromColumn = XRefFromColumn; var sql = InnerJoinSelectClause(xRefFromColumn, Repository.TableName, through.TableName, XRefToColumn, ToTableColumn, PropertyContainingIdValue, models.ToArray()); return(EagerLoadSingleForAll.Execute(models, Repository, MethodName, sql, (result, source) => source.Id == result.GetMember(xRefFromColumn))); }
public IEnumerable <dynamic> EagerLoad(IEnumerable <dynamic> models, dynamic options) { var foreignKeyName = ForeignKeyName(models.First()) as string; var ones = @" select * from {fromTable} where {foreignKey} in ({inClause})" .Replace("{fromTable}", Repository.TableName) .Replace("{foreignKey}", foreignKeyName) .Replace("{inClause}", InClause(models, Id())); return(EagerLoadSingleForAll.Execute(models, Repository, MethodName, ones, (result, source) => source.Id == result.GetMember(foreignKeyName))); }