private static async Task TestAsync() { var cmd = Util.Adapter; MEZUNBOL mezunbol = await cmd.QuerySingleAsync(new FluentSelect<MEZUNBOL>('@').SelectAll().Where().Equals(m => m.MEZUNBOLK, 30).AsSelect()); FK<MEZUNBOL> mezunFK = new FK<MEZUNBOL>(mezunbol, Util.Adapter); mezunFK.Join<SICIL>() .On(m => m.MEZUNBOLK, s => s.MEZUNBOLK) .LoadChildsAsync(m => m.SICILs).Wait(); SICIL sicil = cmd.SelectSingle<SICIL>(); FK<SICIL> sicilFK = new FK<SICIL>(sicil, cmd); sicilFK = await sicilFK.Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK).SetAsync(s => s.PERSONELTIP); sicilFK = await sicilFK.Join<MEZUNBOL>().On(s => s.MEZUNBOLK, m => m.MEZUNBOLK).SetAsync(s => s.MEZUNBOL); var sicilList = await cmd.SelectAsync<SICIL>(); FKs<SICIL> fks = await new FKs<SICIL>(sicilList, cmd) .Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK) .SetAsync(s => s.PERSONELTIP); fks.Join<MEZUNBOL>() .On(s => s.MEZUNBOLK, m => m.MEZUNBOLK) .SetAsync(s => s.MEZUNBOL).Wait(); }
private static void Test() { var cmd = Util.Adapter; MEZUNBOL mezunbol = cmd.SelectSingle<MEZUNBOL>(); FK<MEZUNBOL> mezunFK = new FK<MEZUNBOL>(mezunbol, Util.Adapter); mezunFK.Join<SICIL>() .On(m => m.MEZUNBOLK, s => s.MEZUNBOLK) .LoadChilds(m => m.SICILs); PERSONELTIP personelTip = cmd.SelectSingle<PERSONELTIP>(); FK<PERSONELTIP> personekTipFK = new FK<PERSONELTIP>(personelTip, Util.Adapter); personekTipFK.Join<SICIL>().On(p => p.PERSONELTIPK, s => s.PERSONELTIPK).LoadChilds(p => p.SICILs); SICIL sicil = cmd.SelectSingle<SICIL>(); cmd.Upsert(sicil, new Expression<Func<SICIL, object>>[] { s => s.ADI, s => s.SOYADI }, null); FK<SICIL> sicilFK = new FK<SICIL>(sicil, cmd); Stopwatch bench = Stopwatch.StartNew(); sicilFK.Join<PERSONELTIP>().On(s => s.PERSONELTIPK, p => p.PERSONELTIPK).Set(s => s.PERSONELTIP) .Join<MEZUNBOL>().On(s => s.MEZUNBOLK, m => m.MEZUNBOLK).Set(s => s.MEZUNBOL); FK<PERSONELTIP> inner = new FK<PERSONELTIP>(sicil.PERSONELTIP, cmd); inner.Join<SICIL>().On(p => p.PERSONELTIPK, s => s.PERSONELTIPK).LoadChilds(p => p.SICILs); bench.Stop(); Console.WriteLine(bench.ElapsedMilliseconds); var sicilList = cmd.Select<SICIL>(); bench = Stopwatch.StartNew(); for (int j = 0; j < 100; ++j) { FKs<SICIL> fks = new FKs<SICIL>(sicilList, cmd) .Join<PERSONELTIP>() .On(s => s.PERSONELTIPK, p => p.PERSONELTIPK) .Set(s => s.PERSONELTIP) .Join<MEZUNBOL>() .On(s => s.MEZUNBOLK, m => m.MEZUNBOLK) .Set(s => s.MEZUNBOL); } bench.Stop(); Console.WriteLine(bench.ElapsedMilliseconds); // fk.Join(m => m.SICILs, s => s.MEZUNBOLK); //fk.Join(mezunbol, m => m.SICILs, s => s.MEZUNBOLK); }