Zerthz
Explore posts from serversMVC model binding issues
Hello,
I got some issues with model binding for my MVC endpoint. All doubles fail and become 0/null.
I went into the model state to check what was wrong, and it said that it had an invalid value. The value had a period in it as the separator. I copied the exact value the model state said was invalid and placed it into the local and it was accepted no problem.
Have anyone seen an issue like this? What would you recommend to deal with it, a custom binder?
6 replies
❔ Architecture when using external API
Howdy,
I got an application, and it's going to make a call to an external API, get back a response. Take that response and transform it to the models I use for my application. Pretty straight forward stuff.
Worth noting, my Application is 3 layers, the main Application Layer a WebApi project, a domain layer with all my models and such, and the data layer for all my data needs.
My issue comes from the fact that the response the external API provides is this massive object with a lot of nested objects etc. And I don't really like that it can leak into other things.
I'm not sure if it's better to break it out into it's own class library, sort of putting it on an island so it's probably gonna stay isolated.
Or if it's better to go in and rename all the classes in the response model to sort of "tag" them with the API it's calling, so that they're distinct and not leaky?
With Leaky I mean that I have a "Comic" class for my application, but this response object also wants to have a "Comic" class so it gets gross. But I could name the response like ApiComic or whatever?
What is a good way to deal with this?
11 replies
✅ implementing OneOf with Repository pattern
Hey,
I'm using a repository pattern where my repos do all the communication with databases. Nothing special. I'm wondering if my repos should know about the OneOf nuget package or if that's for the service to deal with? So that the service maps whatever the repo says to a oneof type
9 replies
❔ Visual Studio 22 not showing errors
Hey, I'm running c# in Visual Studio 22.
The issue now is that it's not showing error squigglies even with the setting turned on. It's also not giving me the option to implement interfaces from quick refactors.
I've reset all settings to general default, with the reset settings tool. Still doesn't work.
Anyone seen this issue and how to fix it?
5 replies
SignalR ConnectionManager Singleton
Hey, does anyone have any experience creating a ConnectionManager for SignalR? Right now I feel like I have to create my connection and all immediately in the program.cs (I am new to signalR). But I don't like that at all. However if you create a singleton of the connection, does it subscribe still? where do you put all those events? The same place you run start.async()?
6 replies
Read a file line by line and append to a Blazor element
So I'm trying to create the same effect as a console executing and text scrolling up line by line pretty fast. But have it in the web via Blazor. Any idea how to make this effect? I'm not trying to have an interactive console just make the output look like one.
When doing it in the console I use the StreamReader on the file, and use Console.Writeline(); not sure what I would do for blazor. Maybe still StreamReader and put it into a list that I do a foreach on?
3 replies