示例#1
0
        public void TestMonoConcat2([IdlProviders] string context)
        {
            using (var db = new TestDataConnection(context))
            {
                var ds     = new IdlPatientSource(db);
                var t      = "A";
                var query1 = Concat2(
                    from y in ds.Persons() select y.Name,
                    from x in ds.Persons() where x.Name == t select x.Name);

                Assert.That(query1.ToList(), Is.Not.Null);
            }

            using (var db = new TestDataConnection(context))
            {
                var ds     = new IdlPatientSource(db);
                var t      = "A";
                var query2 = Concat2(
                    from y in ds.Persons() select y.Name,
                    from x in ds.Persons() where x.Name == t select x.Name);

                Assert.That(query2.ToList(), Is.Not.Null);
            }
        }
示例#2
0
        public void TestJoinOrder([IdlProviders] string context)
        {
            using (var db = GetDataContext(context))
            {
                var source = new IdlPatientSource(db);

                // Success when use result from second JOIN
                var query1 =
                    from p1 in source.GrandChilds()
                    join p2 in source.Persons() on p1.ParentID equals p2.Id
                    join p3 in source.Persons() on p1.ChildID equals p3.Id
                    select new
                {
                    p1.ChildID,
                    p1.ParentID,
                    //Parent = p2,
                    Child = p3,
                };

                var data1 = query1.ToList();

                // Fail when use result from first JOIN
                var query2 = from p1 in source.GrandChilds()
                             join p2 in source.Persons() on p1.ParentID equals p2.Id
                             join p3 in source.Persons() on p1.ChildID equals p3.Id
                             select
                             new
                {
                    p1.ChildID,
                    p1.ParentID,
                    Parent = p2,
                    //Child = p3,
                };
                var data2 = query2.ToList();
            }
        }
示例#3
0
 protected GenericQueryBase(ITestDataContext ds)
 {
     m_ds = new IdlPatientSource(ds);
 }
示例#4
0
 public static IEnumerable <IdlPatientEx> ToIdlPatientEx(this IQueryable <IdlPatient> list, IdlPatientSource source)
 {
     return(from x in list
            join person in source.Persons() on x.Id.Value equals person.Id.Value
            select new IdlPatientEx
     {
         Id = x.Id,
         Person = new IdlPerson {
             Id = new IdlTest.ObjectId {
                 Value = person.Id
             }, Name = person.Name,
         },
     });
 }