c# - A better way to do this LINQ query? -
I have a collection of data objects that can not be directly accessible to each other. I think the best solution is to To create a question would be to get the database people, but in the meantime, is there some way to strengthen it up? Conflicting = allFoos.Where (foo = & gt; foo.ElectronicSerialNumber = 0 & amp;! Foo.BarID = interestingBar.ID)
.Join (fooInfoCollection, foo = & Gt; foo.ElectronicSerialNumber, fooInfo = & gt; fooInfo.ElectronicID, (foo, fooInfo) & gt; foo) .Join (allBars, foo = & gt; foo.BarID, bar = & gt; bar.ID , (Foo, bar) => bar). Where (bar = & gt; bar.SomeCriteria == incorrect). FirstOrDefault (); If (conflicting! = Zero) {doStuff (conflicting); } itemprop = "text"> It looks like you've got all the foos, all the FooInfos and all the bars from the
Database so that you can do a query where you only need the object once in the form of a result. If you have to exclude all these items from the database for any other query then this is okay, but if you find all of these items for just one query then it is extremely incompatible. You should try to perform the query and retrieve the database returned only one object.
Even if there are no foreign keys lacking, you can still get it, and you can do Linq to type in between sql even if they In fact, they are not present in the database, which makes it easy to prepare your questions.
Comments
Post a Comment