Пример #1
0
        public void Test([IncludeDataSources(TestProvName.AllSqlServer2008Plus)]
                         string context)
        {
            using (var db = GetDataContext(context))
                using (db.CreateLocalTable <Table1>())
                    using (db.CreateLocalTable <Table2>())
                        using (db.CreateLocalTable <Table3>())
                            using (db.CreateLocalTable <Table4>())
                                using (db.CreateLocalTable <Table5>())
                                {
                                    var q =
                                        from t1 in db.GetTable <Table5>()
                                        from t2 in
                                        (from t3 in t1.Table4s.SelectMany(x => x.Table1s)
                                         from t4 in
                                         from t5 in t3.Table4Ref !.Table5Ref.Table5Ref !.Table4s
                                         from t6 in t5.Table1s
                                         select t6
                                         select t4.Field1)
                                        from t7 in
                                        (from t8 in t1.Table5Ref !.Table4s.SelectMany(x => x.Table1s)
                                         from t9 in
                                         from t10 in t8.Table2Ref.Table3Ref.Table2s
                                         from t11 in t10.Table1s
                                         select t11
                                         select t9.Field1)
                                        where t2 == t7
                                        select t7;

                                    var result = q.ToArray();
                                }
        }
        public void Test([IncludeDataSources(TestProvName.AllSqlServer2008Plus)]
                         string context)
        {
            using (var db = GetDataContext(context))
            {
                var q =
                    from t1 in db.GetTable <Table5>()
                    from t2 in
                    (from t3 in t1.Table4s.SelectMany(x => x.Table1s)
                     from t4 in
                     from t5 in t3.Table4Ref !.Table5Ref.Table5Ref !.Table4s
                     from t6 in t5.Table1s
                     select t6
                     select t4.Field1)
                    from t7 in
                    (from t8 in t1.Table5Ref !.Table4s.SelectMany(x => x.Table1s)
                     from t9 in
                     from t10 in t8.Table2Ref.Table3Ref.Table2s
                     from t11 in t10.Table1s
                     select t11
                     select t9.Field1)
                    where t2 == t7
                    select t7;

                var sql = q.ToString();
                var idx = sql.IndexOf(",");

                Assert.That(idx, Is.EqualTo(-1));
            }
        }