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

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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));
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #8
0
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }