Last post Oct 19, 2016 04:06 PM by PatriceSc
Oct 19, 2016 03:48 PM|TheNutCracker|LINK
I see that in the Visual Studio Object Browser that a 'RazorPagesSection' type has 2 public properties that are being set in '/Views/web.config' file in an MVC default project. The properties are shown as siblings in the 'Object Browser' window but they
are configured in a parent/child relationship in the web.config file. My question is not about whether this works from a technical standpoint. Obviously, it does. But whether it's bad practice and is one of those mistakes that you can't go back and just fix
when your as big as Microsoft without affecting so many people. Wouldn't the proper way to configure these properties be as siblings in the web.config files? Just curious.
***EDIT***: I guess if attributes are considered properties of the type then this makes sense still. I still wonder why two different properties are being set 2 different ways. The 'namespaces' property is a collection so maybe that has too be done as child
Oct 19, 2016 04:06 PM|PatriceSc|LINK
Just check the type for those properties. You'll likely see that PageBaseType is a single object while Namespaces is a collection of objects. And so you have different needs for both (in one case you are sure you'll ever have one single value while in the
other case you need to be able to represent 0, 10, 100 or more objects in the XML marlkup.