2020-09-21 21:20:46 +02:00
|
|
|
|
using Umbraco.Configuration;
|
2020-03-16 14:02:08 +01:00
|
|
|
|
|
2020-08-20 22:18:50 +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>
|
2020-09-18 12:53:10 +02:00
|
|
|
|
public class ModelsBuilderSettings
|
2020-03-16 14:02:08 +01:00
|
|
|
|
{
|
2020-10-16 15:23:02 +11:00
|
|
|
|
// TODO: This should not go into App_Data - that folder isn't really a real thing anymore
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-09-21 21:20:46 +02:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
public bool FlagOutOfDateModels
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _flagOutOfDateModels;
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
2020-09-21 21:20:46 +02:00
|
|
|
|
if (!ModelsMode.IsLive())
|
2020-08-20 08:24:23 +01:00
|
|
|
|
{
|
|
|
|
|
|
_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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
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>
|
2020-08-20 08:24:23 +01:00
|
|
|
|
public int DebugLevel { get; set; } = 0;
|
2020-03-16 14:02:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|