Files
Umbraco-CMS/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs

86 lines
3.3 KiB
C#
Raw Normal View History

using Umbraco.Configuration;
2020-03-16 14:02:08 +01:00
namespace Umbraco.Core.Configuration.Models
2020-03-16 14:02:08 +01:00
{
/// <summary>
2020-03-18 11:29:29 +01:00
/// Represents the models builder configuration.
2020-03-16 14:02:08 +01:00
/// </summary>
public class ModelsBuilderSettings
2020-03-16 14:02:08 +01:00
{
// TODO: This should not go into App_Data - that folder isn't really a real thing anymore
public static string DefaultModelsDirectory => "~/App_Data/Models";
2020-03-18 11:29:29 +01:00
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets a value indicating whether the whole models experience is enabled.
2020-03-16 14:02:08 +01:00
/// </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; set; } = false;
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets the models mode.
2020-03-16 14:02:08 +01:00
/// </summary>
public ModelsMode ModelsMode { get; set; } = ModelsMode.Nothing;
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets the models namespace.
2020-03-16 14:02:08 +01:00
/// </summary>
/// <remarks>That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.</remarks>
public string ModelsNamespace { get; set; }
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets a value indicating whether we should enable the models factory.
2020-03-16 14:02:08 +01:00
/// </summary>
/// <remarks>Default value is <c>true</c> because no factory is enabled by default in Umbraco.</remarks>
public bool EnableFactory { get; set; } = true;
private bool _flagOutOfDateModels;
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets a value indicating whether we should flag out-of-date models.
2020-03-16 14:02:08 +01:00
/// </summary>
2020-03-18 11:29:29 +01:00
/// <remarks>
/// 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 <c>false</c>.
/// </remarks>
public bool FlagOutOfDateModels
{
get => _flagOutOfDateModels;
set
{
if (!ModelsMode.IsLive())
{
_flagOutOfDateModels = false;
}
_flagOutOfDateModels = value;
}
}
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets the models directory.
2020-03-16 14:02:08 +01:00
/// </summary>
/// <remarks>Default is ~/App_Data/Models but that can be changed.</remarks>
public string ModelsDirectory { get; set; } = DefaultModelsDirectory;
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets a value indicating whether to accept an unsafe value for ModelsDirectory.
2020-03-16 14:02:08 +01:00
/// </summary>
2020-03-18 11:29:29 +01:00
/// <remarks>
/// An unsafe value is an absolute path, or a relative path pointing outside
/// of the website root.
/// </remarks>
public bool AcceptUnsafeModelsDirectory { get; set; } = false;
2020-03-16 14:02:08 +01:00
/// <summary>
2020-03-18 11:29:29 +01:00
/// Gets a value indicating the debug log level.
2020-03-16 14:02:08 +01:00
/// </summary>
/// <remarks>0 means minimal (safe on live site), anything else means more and more details (maybe not safe).</remarks>
public int DebugLevel { get; set; } = 0;
2020-03-16 14:02:08 +01:00
}
}