private DynamicFunctionWithParam InnerJoinFor(dynamic model) { return((options) => { if (EagerLoadMany.ShouldDiscardCache(options)) { EagerLoadMany.Cache = null; } if (EagerLoadMany.Cache != null) { return EagerLoadMany.Cache; } string innerJoinSelectClause = InnerJoinSelectClause(XRefFromColumn, toTable, throughTable, XRefToColumn, ToTableColumn, PropertyContainingIdValue, model); var models = (Repository.Query(innerJoinSelectClause) as IEnumerable <dynamic>).ToList(); foreach (var m in models) { AddReferenceBackToModel(m, model); } EagerLoadMany.Cache = new DynamicModels(models); EagerLoadMany.Cache.SetMember("New", NewItemDelegate()); AddRepository(EagerLoadMany.Cache, new DynamicRepository(throughTable)); return EagerLoadMany.Cache; }); }
private DynamicFunctionWithParam InnerJoinFor(dynamic model) { return((options) => { if (EagerLoadMany.ShouldDiscardCache(options)) { EagerLoadMany.Cache = null; } if (EagerLoadMany.Cache != null) { return EagerLoadMany.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); } EagerLoadMany.Cache = new DynamicModels(models); AddNewAssociationMethod(EagerLoadMany.Cache, model); AddRepository(EagerLoadMany.Cache, new DynamicRepository(throughTable)); return EagerLoadMany.Cache; }); }
private DynamicFunctionWithParam InnerJoinFor(dynamic model) { return((options) => { if (EagerLoadMany.ShouldDiscardCache(options)) { EagerLoadMany.Cache = null; } if (EagerLoadMany.Cache != null) { return EagerLoadMany.Cache; } var models = (Repository.Query(InnerJoinSelectClause(XRefFromColumn, toTable, throughTable, XRefToColumn, ToTableColumn, PropertyContainingIdValue, model)) as IEnumerable <dynamic>).ToList(); foreach (var m in models) { AddReferenceBackToModel(m, model); } EagerLoadMany.Cache = new DynamicModels(models); AddNewAssociationMethod(EagerLoadMany.Cache, model); return EagerLoadMany.Cache; }); }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); ForeignKey = ForeignKey ?? ForeignKeyFor(model); var toTable = Repository.GetType().Name; AddAssociationMethods(model, ForeignKey, toTable); }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); ForeignKey = ForeignKey ?? SigularId(model); PropertyContainingIdValue = PropertyContainingIdValue ?? Id(); var toTable = Repository.TableName; AddAssociationMethods(model, ForeignKey); }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); FromColumn = FromColumn ?? ForeignKeyFor(model); toTable = Repository.GetType().Name; resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository); AddAssociationMethod(model); Model = model; }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); throughTable = CrossRefenceTable ?? throughTable; fromColumn = FromColumn ?? ForeignKeyFor(model); toTable = Repository.TableName; resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository); AddAssociationMethods(model); Model = model; }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); toTable = Repository.TableName; XRefFromColumn = XRefFromColumn ?? SigularId(model); XRefToColumn = XRefToColumn ?? SigularId(Repository); ToTableColumn = ToTableColumn ?? Id(); PropertyContainingIdValue = PropertyContainingIdValue ?? Id(); AddAssociationMethod(model); Model = model; }
public void Init(dynamic model) { EagerLoadMany = new EagerLoadMany(); throughTable = XRefTable ?? throughTable; toTable = Repository.TableName; XRefFromColumn = XRefFromColumn ?? SigularId(model); XRefToColumn = XRefToColumn ?? SigularId(Repository); ToTableColumn = ToTableColumn ?? Id(); PropertyContainingIdValue = PropertyContainingIdValue ?? Id(); AddAssociationMethods(model); Model = model; }
public IEnumerable <dynamic> EagerLoad(IEnumerable <dynamic> models, dynamic options) { var sql = InnerJoinSelectClause(XRefFromColumn, toTable, throughTable, XRefToColumn, ToTableColumn, PropertyContainingIdValue, models.ToArray()); return(EagerLoadMany.Execute(options, Repository, MethodName, sql, models, XRefFromColumn)); }
public IEnumerable <dynamic> EagerLoad(IEnumerable <dynamic> models, dynamic options) { var sql = InnerJoinSelectClause(fromColumn, toTable, throughTable, resolvedForeignKey, models.ToArray()); return(EagerLoadMany.Execute(options, Repository, Named, sql, models, fromColumn)); }