示例#1
0
文件: Association.cs 项目: bpugh/Oak
        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;
            });
        }
示例#2
0
文件: Association.cs 项目: bpugh/Oak
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }
示例#3
0
文件: Association.cs 项目: bpugh/Oak
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            FromColumn = FromColumn ?? ForeignKeyFor(model);

            toTable = Repository.GetType().Name;

            resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository);

            AddAssociationMethod(model);

            Model = model;
        }
示例#4
0
文件: Association.cs 项目: bpugh/Oak
        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;
        }
示例#5
0
文件: Association.cs 项目: bpugh/Oak
        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));
        }
示例#6
0
文件: Association.cs 项目: bpugh/Oak
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            FromColumn = FromColumn ?? ForeignKeyFor(model);

            toTable = Repository.GetType().Name;

            resolvedForeignKey = ForeignKey ?? ForeignKeyFor(Repository);

            AddAssociationMethod(model);

            Model = model;
        }
示例#7
0
文件: Association.cs 项目: bpugh/Oak
        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;
        }
示例#8
0
文件: Association.cs 项目: bpugh/Oak
        public void Init(dynamic model)
        {
            SelectMany = new SelectMany();

            ForeignKey = ForeignKey ?? ForeignKeyFor(model);

            var toTable = Repository.GetType().Name;

            AddAssociationMethods(model, ForeignKey, toTable);
        }