Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collection-valued parameters with The Entity Framework?

In my last project i decided to use Entity Framework and it was all going well until i try to get datas with "where in", i got an error.

After a tiny search i ve come up with this post and that post.

This is what i am trying to do

var all = fooelements
              .Where(l=>controlsToGet
                            .Contains(l.Control.Name));

Is there any to handle it with lambda expressions or linq with the Entity Framework ?

Thank you

like image 910
Barbaros Alp Avatar asked Jun 05 '26 21:06

Barbaros Alp


1 Answers

Building upon the previous answer I have a tip that makes it easy to do this here:

Tip 8 - How to write 'WHERE IN' style queries using LINQ to Entities

Hope this helps

Alex James

Program Manager - Entity Framework Team

Entity Framework Tips

like image 133
Alex James Avatar answered Jun 08 '26 09:06

Alex James



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!