Entity Framework - Linq To Entities - Many-To-Many Query Problems -


I'm having trouble inquiring from many-to-many relationships in Linq to Entities, I basically use Linq Trying to replicate this query:

  Choose at least customer customer from the customer. Customer.CustomerID = CustomerInterest.CustomerID Skip Add Interest on Customer Interest.InterestID = Interest.InterestID Where Interest Interest Name = 'Football' I have looked around the net and in fact There is no such good example as to how to do it. The closest I have found is:  
  list & lt; Customers & gt; __Customers = (_LCustomers in "CustomerInterest.Interest") _LCustomers.CustomerInterest.Any (x => x.Interest.InterestName == "football") Select _LCustomers) .toList (); The problem with this is that if a customer has more than one interest and one of them is "football" then all are returned, I have seen all () , In which there is an inverse problem, i.e. only if they have a benefit and football, if they are two and none of these is football, then they will not return.  

Anyone got any ideas?

Try it out,

  var results from ctx.Customer i From c.Interest where i.InterestName == "football" is selected c;  

Hope this helps,


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -