Need help with AspNetCore and GUID.
Well I have got the following code for my register method in my webapi (Shown on first image. It is pretty simple). I am running my xUnit test for this method (everything is good) but it seems that I can't access my user.Id normally (I am returning it via "return Ok(user.Id);" line). Somehow debugger shows me that I have got two Id properties, one is actual Id and another just filled with zeros (shown on second photo). I would be grateful if someone explains me what is the problem with them and how can I access actual Id
17 Replies
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
May I ask what is the problem with Guid as an id? I saw just people in youtube use them so I was thinking it is default approach
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Oh you mean that I won't use Id when I look for users? That what you mean?
TeBeCo
REPL Result: Success
Result: ValueTuple<Guid, Guid, Guid, Guid, Guid, Guid, Guid, ValueTuple<Guid, Guid, Guid>>
Compile: 215.179ms | Execution: 22.803ms | React with ❌ to remove this embed.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Oh I see
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Well fair point
I understand now
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Thank you for your explanation, will redo my db in that case (I used only Guids for ids in my dbs)
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Oh I see, quite convinient in that case, I wanted to ask about it, because on my photo Id provided by AspNetCore was already in string
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
I see, thank you for your explanation, it really helped me
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered