コード例 #1
0
ファイル: Association.cs プロジェクト: OxPatient/Oak
        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;
            });
        }
コード例 #2
0
        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;
            });
        }
コード例 #3
0
        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;
            });
        }