AddMvc builder calls redundancy #5934
Comments
The
That's exactly the reason. Someone would be asking the opposite question if we pared it down to the 'minimal' set of Breaking up the monolith into pieces was complex and sometimes forced us into some inelegant choices. I think I'll still be answering questions on this for the rest of my life 👍 |
Thanks @rynowak and that makes sense. Appreciate the answer. I'm writing a blog about the AddMvcCore and AddMvc methods so it's good to know the reason. |
Send us a link when you post it! |
@Eilon - Sure, here is the first part - https://www.stevejgordon.co.uk/asp-net-core-mvc-anatomy-addmvccore - Hopefully it's all accurate! |
And this post features @rynowak's quick feedback! - https://www.stevejgordon.co.uk/asp-net-core-anatomy-part-2-addmvc |
These are great posts, love them both! A little more info about the The other complication is that the |
Thanks @rynowak - I really appreciate the feedback and additional info. I'll take a look at those extra links. |
This may be more a query than an issue. I've been looking at the source, specifically the AddMvc extension method.
Part of the code looks like this
Within AddRazorViewEngine it calls AddViews. Therefore, why do we call AddViews first. Seems redundant? Am I missing a reason, other than this method being a bit more explicit about what it's adding?
In addition, AddDataAnnotations is called within AddViews. Therefore, calling it explicitly later on also seems redundant? It seems that the lines above could actually be reduced to the following, and still perform equally.
Interested to understand the design decisions here?
The text was updated successfully, but these errors were encountered: