Exemple #1
0
        public void LeftJoinTests()
        {
            List <PrimaryData> primaryDatas = PrimaryData.CreateTestList();
            List <OtherData>   otherDatas   = OtherData.CreateTestList();

            var result1 = primaryDatas.AsQueryable().LeftJoin(otherDatas,
                                                              l => l.NumberPd,
                                                              i => i.NumberOd,
                                                              (l, i) => new { Pdn = l.NumberPd, Pds = l.StringPd, Odn = i?.NumberOd, Ods = i?.StringOd })
                          .ToList();


            TestAsserts.NumberLeftJoin(result1);

            var result2 = primaryDatas.AsQueryable().LeftJoin(otherDatas,
                                                              l => new { K1 = (int?)l.NumberPd, K2 = l.StringPd },
                                                              i => new { K1 = i.NumberOd, K2 = i.StringOd },
                                                              (l, i) => new { Pdn = l.NumberPd, Pds = l.StringPd, Odn = i?.NumberOd, Ods = i?.StringOd })
                          .ToList();

            TestAsserts.NumberStringLeftJoin(result2);
        }
        public void LeftJoinTests()
        {
            List<PrimaryData> primaryDatas = PrimaryData.CreateTestList();
            List<OtherData> otherDatas = OtherData.CreateTestList();

            var result1 = primaryDatas.AsQueryable().LeftJoin(otherDatas.AsQueryable(),
                                                              "NumberPd",
                                                              "NumberOd",
                                                              new List<string>() { "NumberPd AS Pdn", "StringPd AS Pds" },
                                                              new List<string>() { "NumberOd AS Odn", "StringOd AS Ods" })
                                                    .ToDynamicList();


            TestAsserts.NumberLeftJoin(result1);

            var result2 = primaryDatas.AsQueryable().LeftJoin(otherDatas.AsQueryable(),
                                                              " new { Int?(NumberPd) AS K1, StringPd AS K2}",
                                                              " new { NumberOd AS K1, StringOd AS K2}",
                                                              new List<string>() { "NumberPd AS Pdn", "StringPd AS Pds" },
                                                              new List<string>() { "NumberOd AS Odn", "StringOd AS Ods" })
                                        .ToDynamicList();

            TestAsserts.NumberStringLeftJoin(result2);
        }