Beispiel #1
0
        public void TestMonoConcat2()
        {
            ForMySqlProvider(
                db =>
            {
                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);
            });

            ForMySqlProvider(
                db =>
            {
                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);
            });
        }
Beispiel #2
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,
         },
     });
 }
Beispiel #3
0
        public void TestJoinOrder([IdlProviders] string providerName)
        {
            ForProvider(
                providerName,
                db =>
            {
                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();
            });
        }
Beispiel #4
0
        public void TestConvertFunction()
        {
            ForMySqlProvider(
                db =>
            {
                var ds = new IdlPatientSource(db);
                var r1 = ds.Patients().ToList();
                var r2 = ds.Persons().ToList();

                Assert.That(r1, Is.Not.Empty);
                Assert.That(r2, Is.Not.Empty);

                var r3 = ds.Patients().ToIdlPatientEx(ds);
                var r4 = r3.ToList();
                Assert.That(r4, Is.Not.Empty);
            });
        }