EF/Linq select all columns of main table, but only some cols of joined table?
I find myself often wanting to select all of a table, but very limited columns of joined tables.
Is it possible to do without explicitly listing all columns?
Example:
20 Replies
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
.Include will get all, but it won't help the query only get A2 for ThingTwo
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I gave it a try and you can't seem to do anything like that. I can only find how to do it by explicitly stating each individual column I want from ThingOne
You can filter rows inside an Include, but not columns
ooh hang on, i think i see what im doing wrong let me try again
Collection navigation access can be filtered by composing Where, OrderBy(Descending), ThenBy(Descending), Skip or Take operations.
yeah doesnt seem possible
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
i dont get what you're trying to do
can you do? where
Bar
is a nav prop? yes.
other than that i dont understand what you're trying to achieve.Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
im not sure EF would ever be able to support that
where does the spread stop
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
which includes the nav props
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
side note: that will track
x
as an entity
any changes you make will be committed back to the db if you saveUnknown User•13mo ago
Message Not Public
Sign In & Join Server To View
just x