In that case, yeah it sucks. Btw I've noticed the "Patient/Race" references, this some sort of medical application? Usually they are coded in the worst possible way xD
Static acess to HttpContext prevents unit tests. With HttpContext in a constructor you can keep control if your class really need it and mock it in unit tests.
HttpContext is a class with all information of the Request, Response, Session, Cookies and things like this. Should not be inside Domain code, but old ASP.NET allows this and developers created a lot of aberrations.
Well, what would be the alternative? Rewriting the whole app in another language/framework?
ASP.NET is a solid framework/ecosystem with tons of support and very good documentation, much different to the real garbage you'll get with untyped languages like JS..
I don't know whether it is possible to write html directly on the line where the Html.Convert is used. My guess is author had some troubles to write html there so he just used this /smart/ move. Used Razor once. Not my favorite template language.
Yes, it's possible because I just removed the method. Maybe in .NET Framework 4.8 not, but the server-side <text> tag exists for a reason, the author is lazy and didn't google anything.
I wonder if the writer just didn't know to put an @ in front of the if and got frustrated enough to do this?
I always like to imagine what struggles the writer was going through when they came up with such silly solutions, and half the time I'm pondering over my past self π
I used to love razor. Now all my views are in vue. Working on razor was rough. I prefer Mvc routing but I wonβt ever design views in razor again lol.
First time I tried to use partials to render bootstrap modals I found out how hard it was. Imagine that for a list of instances of a particular model. Gotta generate them with IDs but I also didn't want to have the request be massive. I just went nuts and used JS and ViewComponents... π€·ββοΈ
70
u/jan04pl Feb 14 '23
That's an extension method (doesn't exist in the official API) so maybe has some side effects that aren't known here..
9
u/JustSpaceExperiment Feb 14 '23
I don't know whether it is possible to write html directly on the line where the Html.Convert is used. My guess is author had some troubles to write html there so he just used this /smart/ move. Used Razor once. Not my favorite template language.
13
u/shiftkit Feb 14 '23
I wonder if the writer just didn't know to put an @ in front of the if and got frustrated enough to do this?
I always like to imagine what struggles the writer was going through when they came up with such silly solutions, and half the time I'm pondering over my past self π
17
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 14 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
13
u/fiddz0r Feb 14 '23
My current project uses MVC and whenever I have a task that requires front end coding I just want to die
4
u/Splatoonkindaguy Feb 14 '23
Asp.net is so sexy
3
u/scunliffe Feb 15 '23
Please do whatever you can to remove the
CSS is your friend ;-)
3
u/trevster344 depraved Feb 14 '23
I used to love razor. Now all my views are in vue. Working on razor was rough. I prefer Mvc routing but I wonβt ever design views in razor again lol.