I noticed they're using a colon (:) in the appsettings.get. Is there any special significance to this? Or is this just like any letter/character you can use?
No, it's just a way of grouping settings, so any settings regarding "blog" will start with "blog:" Other common conventions are using a ".", so "blog.theme" etc. Such naming conventions also allow you to build your own config classes, like;
BlogSettings.Get("theme")
and all "Get" in "BlogSettings" does is add "blog:" to the start of the requested setting, so you could also have
ProductSettings.Get("theme")
and under the covers that will access the "product:theme" setting.
I'm afraid I no longer use this forum due to the new point allocation system.
So you can use dots and colons as valid characters for use in app setting names? They're not specially treated by asp.net in any way, it's just for user readability?
Participant
958 Points
443 Posts
colon : in appsettings
Apr 19, 2014 01:45 PM|CASPartan|LINK
I was browsing the source code of MiniBlog with the goal of studying some of its techniques.
I noticed they're using a colon (:) in the appsettings.get. Is there any special significance to this? Or is this just like any letter/character you can use?
All-Star
37441 Points
9076 Posts
Re: colon : in appsettings
Apr 19, 2014 03:36 PM|AidyF|LINK
No, it's just a way of grouping settings, so any settings regarding "blog" will start with "blog:" Other common conventions are using a ".", so "blog.theme" etc. Such naming conventions also allow you to build your own config classes, like;
BlogSettings.Get("theme")
and all "Get" in "BlogSettings" does is add "blog:" to the start of the requested setting, so you could also have
ProductSettings.Get("theme")
and under the covers that will access the "product:theme" setting.
Participant
958 Points
443 Posts
Re: colon : in appsettings
Apr 19, 2014 06:32 PM|CASPartan|LINK
All-Star
37441 Points
9076 Posts
Re: colon : in appsettings
Apr 20, 2014 07:46 AM|AidyF|LINK
Yeah it's just for readability.