using Umbraco.Configuration;
namespace Umbraco.Core.Configuration.Models
{
///
/// Represents the models builder configuration.
///
public class ModelsBuilderSettings
{
// TODO: This should not go into App_Data - that folder isn't really a real thing anymore
public static string DefaultModelsDirectory => "~/umbraco/models";
///
/// Gets a value indicating whether the whole models experience is enabled.
///
///
/// If this is false then absolutely nothing happens.
/// Default value is false which means that unless we have this setting, nothing happens.
///
public bool Enable { get; set; } = false;
///
/// Gets the models mode.
///
public ModelsMode ModelsMode { get; set; } = ModelsMode.Nothing;
///
/// Gets the models namespace.
///
/// That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.
public string ModelsNamespace { get; set; }
///
/// Gets a value indicating whether we should enable the models factory.
///
/// Default value is true because no factory is enabled by default in Umbraco.
public bool EnableFactory { get; set; } = true;
private bool _flagOutOfDateModels;
///
/// Gets a value indicating whether we should flag out-of-date models.
///
///
/// Models become out-of-date when data types or content types are updated. When this
/// setting is activated the ~/App_Data/Models/ood.txt file is then created. When models are
/// generated through the dashboard, the files is cleared. Default value is false.
///
public bool FlagOutOfDateModels
{
get => _flagOutOfDateModels;
set
{
if (!ModelsMode.IsLive())
{
_flagOutOfDateModels = false;
}
_flagOutOfDateModels = value;
}
}
///
/// Gets the models directory.
///
/// Default is ~/App_Data/Models but that can be changed.
public string ModelsDirectory { get; set; } = DefaultModelsDirectory;
///
/// Gets a value indicating whether to accept an unsafe value for ModelsDirectory.
///
///
/// An unsafe value is an absolute path, or a relative path pointing outside
/// of the website root.
///
public bool AcceptUnsafeModelsDirectory { get; set; } = false;
///
/// Gets a value indicating the debug log level.
///
/// 0 means minimal (safe on live site), anything else means more and more details (maybe not safe).
public int DebugLevel { get; set; } = 0;
}
}