private DynamicFunctionWithParam InnerJoinFor(dynamic model) { return((options) => { if (SelectMany.ShouldDiscardCache(options)) { SelectMany.Cache = null; } if (SelectMany.Cache != null) { return SelectMany.Cache; } string innerJoinSelectClause = InnerJoinSelectClause(fromColumn, toTable, throughTable, resolvedForeignKey, model); var models = (Repository.Query(innerJoinSelectClause) as IEnumerable <dynamic>).ToList(); foreach (var m in models) { AddReferenceBackToModel(m, model); } SelectMany.Cache = new DynamicModels(models); AddNewAssociationMethod(SelectMany.Cache, model); return SelectMany.Cache; }); }
public void Init(dynamic model) { SelectMany = new SelectMany(); ForeignKey = ForeignKey ?? ForeignKeyFor(model); var toTable = Repository.GetType().Name; AddAssociationMethods(model, ForeignKey, toTable); }
public void Init(dynamic model) { SelectMany = new SelectMany(); FromColumn = FromColumn ?? ForeignKeyFor(model); toTable = Repository.GetType().Name; resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository); AddAssociationMethod(model); Model = model; }
public void Init(dynamic model) { SelectMany = new SelectMany(); throughTable = CrossRefenceTable ?? throughTable; fromColumn = FromColumn ?? ForeignKeyFor(model); toTable = Repository.TableName; resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository); AddAssociationMethods(model); Model = model; }
public IEnumerable <dynamic> SelectManyRelatedTo(IEnumerable <dynamic> models, dynamic options) { var sql = InnerJoinSelectClause(fromColumn, toTable, throughTable, resolvedForeignKey, models.ToArray()); return(SelectMany.Execute(options, Repository, Named, sql, models, fromColumn)); }