42 Replies
Venture
can you show the code that makes the actual query?
and is
Portfolio
here an owned entity, or a normal relational object?
venture has one or zero portfolios
ok, I see no include - this is probably just a missed include call
i saw something on that on stack overflow
try
await _context.Ventures.Include(x => x.Portfolio).ToListAsync();
i just didnt understand where to put it
yes that works
EF doesnt fetch relational objects by default, you need to explicitly state that you want them included
would it also be possible to have some of the portfolio relations being returned like that
yep!
.ThenInclude(x => ...)
But, ideally, you should
.Select()
instead^
the ideal way to do this, especially in a web api, is to
.Select
into a DTO
you dont want to return your actual entity models directly to the userI know, but for my Proof of concept its fine for now
sure thing. then
.Include(...).ThenInclude(...)
will workFor a proof of concept I'd be selecting into anonymous objects tbh
Defining them later
Rather than including all over the place
also
Guid?
I dont think u want that on a pkwhy not? perfectly fine
oh, nullable
nullable Guid?
😄
yeah remove the nullability
:catgun:
Sequential IDs gang represent
Guid gets set in the db
vogen ids all the way baby
yeah but its nullable
remove the nullability and you're fine
yeah, otherwise it will set it to necisairy in the db and then I wont be able to post without ID
yes and they are pk so they should never be null
guid is a value type, it has a default non-null value (0000-000000...)
btw like this?
Tech2
💀
Not a list?that name isnt my choise
specially with that many include
😅
Name is whatever, schema seems bad
how do you mean?
What if I want to list 67 skills?
skills?
Uh, techs
ow no
thats also what I thought when I saw that
tech one is technology one and has sub technologies called tech2
so you choose category tech1 sub category tech2
That makes more sense then
Though the naming sucks ass
yup, I know
but thats how my internship did it
I feel like there is a better way of doing this
Yes
A select
aha
let me try
ill add that later
Thnx everyone