restores the MB enable flag
This commit is contained in:
@@ -22,11 +22,18 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
|
||||
{
|
||||
const string prefix = "Umbraco.ModelsBuilder.";
|
||||
|
||||
// giant kill switch, default: false
|
||||
// must be explicitely set to true for anything else to happen
|
||||
Enable = ConfigurationManager.AppSettings[prefix + "Enable"] == "true";
|
||||
|
||||
// ensure defaults are initialized for tests
|
||||
ModelsNamespace = DefaultModelsNamespace;
|
||||
ModelsDirectory = IOHelper.MapPath(DefaultModelsDirectory);
|
||||
DebugLevel = 0;
|
||||
|
||||
// stop here, everything is false
|
||||
if (!Enable) return;
|
||||
|
||||
// mode
|
||||
var modelsMode = ConfigurationManager.AppSettings[prefix + "ModelsMode"];
|
||||
if (!string.IsNullOrWhiteSpace(modelsMode))
|
||||
@@ -94,6 +101,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
|
||||
/// Initializes a new instance of the <see cref="ModelsBuilderConfig"/> class.
|
||||
/// </summary>
|
||||
public ModelsBuilderConfig(
|
||||
bool enable = false,
|
||||
ModelsMode modelsMode = ModelsMode.Nothing,
|
||||
string modelsNamespace = null,
|
||||
bool enableFactory = true,
|
||||
@@ -102,6 +110,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
|
||||
bool acceptUnsafeModelsDirectory = false,
|
||||
int debugLevel = 0)
|
||||
{
|
||||
Enable = enable;
|
||||
ModelsMode = modelsMode;
|
||||
|
||||
ModelsNamespace = string.IsNullOrWhiteSpace(modelsNamespace) ? DefaultModelsNamespace : modelsNamespace;
|
||||
@@ -143,6 +152,15 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
|
||||
throw new ConfigurationErrorsException($"Invalid models directory \"{config}\".");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the whole models experience is enabled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>If this is false then absolutely nothing happens.</para>
|
||||
/// <para>Default value is <c>false</c> which means that unless we have this setting, nothing happens.</para>
|
||||
/// </remarks>
|
||||
public bool Enable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the models mode.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user