c# - Linq to sql, unable to separate query -


So after doing a lot of work, I've got an IM, using linq to execute queries from other queries using sql There is a problem in See below how I liked it. When I did this, I did not set a object reference to an object instance error Finally I feel like how I got a variable I store the query in. NotDownloadedIds is just a filtered table, so I can call it Iqueryable & lt; TableName & gt; I archive in . In this way I can pass it in a method. It equals the ugly query I've got to work:

  var storesLeft = (include y in cDataContext.Categories on x.CategoryID X cDataContext.CategoryCountryCategoryTypeMappings y. CategoryID where (y.StorefrontID = = 73) & amp; & amp ;! (in the Ndid (b cDataContext.CategoryCountryCategoryTypeMappings where (dll in cDataContext.DownloadLogs where dll.DTS.Hour == DateTime.Now.Hour select dll .CategoryCountryCategoryTypeMappingID) select .Contains (b .categorycountryCategoryTypeMappingID) b) Choose ndID.CategoryCountryCategoryTypeMappingID). This includes (x.CategoryCountryCategoryTypeMappingID) x select);  

Whatever I have to do, it is in some other queries different from something like:

  on storesLeft = (from cDataContext.CategoryCountryCategoryTypeMappings in X equals join y in cDataContext.Categories on x.CategoryID is y.CategoryID select where (y.StorefrontID == 73) & amp; & amp;! (Andiaidi in Nhindaunlodedaidi from Andiaidi. Sreneedeta Category Tag Typing Mapping ID). (X. Category Category Country Type Mapping ID);  

While it looks like notDownloadedIds:

  where the dll where (cDataContext.DownloadLogs of X (cDataContext.CategoryCountryCategoryTypeMappings dll.DTS.Hour = = DateTime.Now.Hour selection dll.CategoryCountryCategoryTypeMappingID). This includes (x.CategoryCountryCategoryTypeMappingID) x);  

Before work, and no other 2 thoughts but no? Question 2 What can I do to look the other way?

Edit: To know what this query does on the first place. Not downloaded IDS meets all CCC mappings (category category type mappings), where the line time stamp matches the current time, and its ccmapping has not been found in my existing logs.

You can definitely make inquiries to make it more readable, understandable and concise. You can replace like

  (dll.CategoryCountryCategoryTypeMappingID the dll where dll.DTS.Hour == choose DateTime.Now.Hour in cDataContext.DownloadLogs) .Contains (b.CategoryCountryCategoryTypeMappingID)   

  cDataContext.DownloafLogs.Any (dll = & gt; dll.DTS.Hour == DateTime.Now.Hour & amp; Dll.CategoryCountryCategoryTypeMappingID == b .categorycountryCategoryTypeMappingID)  

Because it is difficult to understand what you are trying to achieve with the above query.


Comments