Consider two tables Bill and Product with a many to many relationship. How do you get all the bills for a particular product using Entity Sql?
相关问题
- Entity Framework Code First Migration
- Entity Framework throws exception - Network Relate
- Check if tie in count of lists using linq
- Slow loading first page - ASP.NET MVC
- query and create objects with a one to many relati
相关文章
-
EF6 DbSet
returns null in Moq - Entity Framework 4.3.1 failing to create (/open) a
- EF6 code first: How to load DbCompiledModel from E
- Why do I need a ToList() to avoid disposed context
- Code-First Add-Migration keeps adding the same col
- EF Codefirst validate unique property?
- EF Core 'another instance is already being tra
- Add XML documentation / comments to properties/fie
You need to use some linq like this;
This assumes that you have used the entitiy framework to build a model for you data. The bills variable will hold a collection of Bill objects that are related to your product object.
Hope it helps.
Something like this
will produce a row for each Bill
Another option is something like this:
Which will produce a row for each matching Product (in this case just one) and the second column in the row will include a nested result set containing the bills for that product.
Hope this helps
Alex