0
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Linq;
|
|
4
|
|
5 using NUnit.Framework;
|
|
6
|
|
7 namespace Data.Linq
|
|
8 {
|
|
9 partial class IdlTest
|
|
10 {
|
|
11 partial class GenericQueryBase
|
|
12 {
|
|
13 protected IQueryable<IdlPatient> AllPatients2
|
|
14 {
|
|
15 get { return m_ds.Patients(); }
|
|
16 }
|
|
17 }
|
|
18
|
|
19 public class GenericConcatQuery1 : GenericQueryBase
|
|
20 {
|
|
21 private String @p1;
|
|
22 private Int32 @p2;
|
|
23
|
|
24 public GenericConcatQuery1(ITestDataContext ds, object[] args)
|
|
25 : base(ds)
|
|
26 {
|
|
27 @p1 = (String)args[0];
|
|
28 @p2 = (Int32) args[1];
|
|
29 }
|
|
30
|
|
31 public override IEnumerable<object> Query()
|
|
32 {
|
|
33 //return Queryable.Concat(
|
|
34 return Concat2(
|
|
35 from y in AllPersons select y.Name,
|
|
36 from x in AllPersons
|
|
37 from z in AllPatients
|
|
38 where (x.Name == @p1 || z.Id == new ObjectId { Value = @p2 })
|
|
39 select x.Name);
|
|
40 }
|
|
41 }
|
|
42
|
|
43 [Test]
|
|
44 public void TestMono03Mono()
|
|
45 {
|
|
46 ForMySqlProvider(
|
|
47 db => Assert.That(new GenericConcatQuery1(db, new object[] { "A", 1 }).Query().ToList(), Is.Not.Null));
|
|
48 }
|
|
49
|
|
50 public class GenericConcatJoinOrderQuery1 : GenericQueryBase
|
|
51 {
|
|
52 private String @p1;
|
|
53 private Int32 @p2;
|
|
54
|
|
55 public GenericConcatJoinOrderQuery1(ITestDataContext ds, object[] args)
|
|
56 : base(ds)
|
|
57 {
|
|
58 @p1 = (System.String)args[0];
|
|
59 @p2 = (System.Int32)args[1];
|
|
60 }
|
|
61
|
|
62 public override IEnumerable<object> Query()
|
|
63 {
|
|
64 return (from j in
|
|
65 //Queryable.Concat(
|
|
66 Concat2(
|
|
67 from y in AllPersons
|
|
68 select new { FirstName = y.Name },
|
|
69 from x in AllPersons
|
|
70 from z in AllPatients
|
|
71 where (x.Name == @p1 || z.Id == new ObjectId { Value = @p2 })
|
|
72 select new { FirstName = x.Name })
|
|
73 join g in AllGrandChilds on j.FirstName equals @p1
|
|
74 orderby g.ParentID.Value
|
|
75 select new { FirstName = g.ParentID.Value.ToString() });
|
|
76 }
|
|
77 }
|
|
78
|
|
79 [Test]
|
|
80 public void TestMono04Mono()
|
|
81 {
|
|
82 ForMySqlProvider(
|
|
83 db => Assert.That(new GenericConcatJoinOrderQuery1(db, new object[] { "A", 1 }).Query().ToList(), Is.Not.Null));
|
|
84 }
|
|
85 }
|
|
86 }
|