c# - LINQ - SELECT DISTINCT with NOT IN -


I have a SQL statement, which I am trying to make a change in a LINQ statement ...

  choose Inter MAC. * From MCFRAQ categories MC where MC Activated = 'right' and mc.folder = 'false'. And this is not my last, LINQ statement  
  (IQueryable & Lt; Object & gt;) db.Manufractor Categories. Where (o => Active == Active ()). (O = & gt; O Folder == folder) Select (i = & Select New (i.Id., i.folder). Except (DB. Manufacturing Corrections Where (T => T. Manufrector_ID == ID). (T = & gt; New {t.Category_id}). ) () Different;  

I have tried it on a whole Sunday, but except the statement is not

Thanks in advance for any help!

Leaving the method requires two sets of the same type - it means that you must select objects in the nested query as well as the external query type ManufractorCategory - then He will select all those categories which are in the first one and not in the other.

An easy choice is to check it in What is the current ID that is to use the method in the ID list that you want to filter. The following should be done:

  var q = db.Manufractor categories. Where (o => active == active). Where (o = & gt; o.folder == folder). Choose (i => New {i.Id, i.folder}). Select (O = & gt;! Db.Manufractor_Categories. (T => T. Manufrector_ID). Content (OID). Undoubtedly ();  

And a simplified version by using the query syntax:

  var from q = db. In the manufrecor range where o.activated == active & amp; amp; o.folder == folder & amp; Select the new {i.Id, i.folder}; Select << code> 
.

Comments