Nakama
Nakama
CC#
Created by Nakama on 11/24/2024 in #help
GetFromJsonAsync and nested objects using FluentResults
I am working on a controller and service that uses FluentResults but I am running into some issues when returning objects inside of the result.
public async Task<Result<MemberDTO>> GetByIdAsync(ulong id)
{
var response = await _httpClient.GetFromJsonAsync<Result<MemberDTO>>($"api/Member/{id}");
return response!;
}
public async Task<Result<MemberDTO>> GetByIdAsync(ulong id)
{
var response = await _httpClient.GetFromJsonAsync<Result<MemberDTO>>($"api/Member/{id}");
return response!;
}
Whenever the above code is ran, the response contains the Result with the correct success message. But the Member itself which is stored in the value property is missing. The controller returns the correct object but even when I map it as a json it fails to do this and returns a null. I'm absolutely clueless what is causing this.
{
"isSuccess": true,
"value": {
"id": 489867864224956400,
"username": "NakamaTM",
"coins": 10,
"messageCount": 23,
"prayDate": null,
"vrcProfile": ""
},
"errors": [],
"successes": [
"Discord User fetched successfully"
]
}
{
"isSuccess": true,
"value": {
"id": 489867864224956400,
"username": "NakamaTM",
"coins": 10,
"messageCount": 23,
"prayDate": null,
"vrcProfile": ""
},
"errors": [],
"successes": [
"Discord User fetched successfully"
]
}
The response from the controller looks as follows.
6 replies
CC#
Created by Nakama on 6/3/2024 in #help
Extending a class while overwriting its properties
No description
13 replies