WAQS Querying: Include and inheritance

7 reasons to use WAQS

WAQS documentation

 

I already wrote on WAQS Include method. However, there is one more point you can’t do with an easy way with EF.

Imagine that you have an entity Person and you have an entity Customer that inherits of Person and this Customer entity has a navigation property to Orders.

Now you want to get all your persons and, if it’s a Customer, you want to get their Orders.

 

In this case WAQS can help you.

Indeed, in this case, WAQS generates a method CustomerIncludeOrders that you just can use like this:

var people = await _context.People.AsAsyncQueryable().CustomerIncludeOrders().ExecuteAsync();
This entry was posted in 12253, 16868, 7674. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>