Hertzole
Hertzole
CC#
Created by Hertzole on 11/25/2024 in #help
Looking for resources regarding login flows and UI states
I've been tinkering around with a desktop application that allows you to optionally use an online account to store data, or just store it locally. So when the user first boots up the application it prompts the user whether they want to use no account or an online account. And when they have selected the account type, then the app should start loading data. This flow is messy to say the least. But if they already have set an account, the application should just boot right into the dashboard and then start fetching data. This is also messy to keep track of. I am not happy at all with my current implementation and now when I'm planning on making a mobile app using MAUI, I want to make it more right. But I can't find any resources for this kind of stuff. Most of my searches just gives me ASP.NET authentication, which is not what I want. So I'd really appreciate some links to resources about how I should manage the flow of my services, my UI states, and whatever else needs to be done. I've just kinda been winging it for this project so I barley know all the terms needed 😅 I'll be extra glad if the resources take MVVM and/or dependency injection into account! Thanks
1 replies
CC#
Created by Hertzole on 12/19/2023 in #help
Use exceptions or error enum?
Hi there I'm currently designing a C# wrapper API for a web API and I'm not entirely sure how I should treat errors. My wrapper basically returns responses in neat structs that the end user then can use however they please. But should possible errors be a part of that struct? Some pseudo code to hopefully explain what options I have
MyResponse response = await Serializer.Deserialize(json);
if(response.message == "Invalid Credentials")
{
// A:
throw new MyAuthException("Invalid credentials");
// B:
return new MyResponse(success: false, errror: MyErrors.InvalidCredentials);
}
MyResponse response = await Serializer.Deserialize(json);
if(response.message == "Invalid Credentials")
{
// A:
throw new MyAuthException("Invalid credentials");
// B:
return new MyResponse(success: false, errror: MyErrors.InvalidCredentials);
}
I'm just not sure what is the most desired for the average .NET developer. I've heard exceptions have some performance overhead when throwing. The library is also designed to be used in Unity and from my experience in Unity, you really don't catch exceptions as often.
8 replies