예제 #1
0
        public void TestJoinOrder()
        {
            ForMySqlProvider(
                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();
            });
        }
예제 #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,
         },
     });
 }
예제 #3
0
 protected GenericQueryBase(ITestDataContext ds)
 {
     m_ds = new IdlPatientSource(ds);
 }