Example #1
0
        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;
            });
        }
Example #2
0
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }
Example #3
0
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            FromColumn = FromColumn ?? ForeignKeyFor(model);

            toTable = Repository.GetType().Name;

            resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository);

            AddAssociationMethod(model);

            Model = model;
        }
Example #4
0
        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;
        }
Example #5
0
        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));
        }
Example #6
0
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            FromColumn = FromColumn ?? ForeignKeyFor(model);

            toTable = Repository.GetType().Name;

            resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository);

            AddAssociationMethod(model);

            Model = model;
        }
Example #7
0
        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;
        }
Example #8
0
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }