In my senario, I have a global setting object, say GlobalSettings, it has a static property “Current” (singleton), and there should be only one GlobalSettings instance.
But…In my data model, there’s an entity “LocalizedContent”:
public class LocalizedContent {
public string Title { get; set; }
public string Content { get; set; }
public string CultureName { get; set; }
}
In the constructor, I want to initialize the instance by setting CultureName to default culture of the system, and I can get the default culture name from GlobalSettings.Current.DefaultCultureName.
However, I don’t want to use the singleton property “GlobalSettings.Current” in LocalizedContent class, since it will result in strong-coupling. So my question is, where is the right place to set this default culture name?
Thanks in advance!
Why not add a constructor to
LocalizedContentthat takes the DefaultCultureName as a parameter?LocalizedContent can then be re-used without a dependency on
GlobalSettings.