Example #1
0
        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)));
        }
Example #2
0
        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)));
        }
Example #3
0
        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)));
        }