c# - Linq outer left join what am I doing wrong? -
reportmessages recieved report cleandirs read storage. i'm trying verify contents of report doing outter join on reportmessages , storage data
i limited lists 100, , still m.count = 213.
what doing wrong ?
var q = r in reportmessages.take(100) join pp in cleannodirs.take(100) on r.filename equals ("{:d2}{:d2}-{}.ps".format(pp.namemin, pp.namesec, pp.cameramac)) ps p in ps.defaultifempty() select new { uploaded = p, orig = r }; var m = q.tolist();
you limit records retrieved each table 100 if have relationship of one-many or many-many result of join more 100 records. in worst case if each record in first collection matches records in second 100*100 records in result.
instead, before materializing results tolist limit 100:
var result = (from r in reportmessages join pp in cleannodirs on r.filename equals ("{:d2}{:d2}-{}.ps".format(pp.namemin, pp.namesec, pp.cameramac)) ps p in ps.defaultifempty() select new { uploaded = p, orig = r }).take(100).tolist(); for more on the different joins , how write them in linq.
Comments
Post a Comment