- Moved ModelsBuilder constant into Core under constants
- Move the registration of configs into the factory - Moved extension methods of ModelsMode into Umbraco.Core - Removed references to Umbraco.Configuration from Umbraco.Infrastructure and Umbraco.ModelsBuilder.Embedded
This commit is contained in:
@@ -3,9 +3,9 @@ using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration
|
||||
{
|
||||
public class ActiveDirectory : IActiveDirectorySettings
|
||||
public class ActiveDirectorySettings : IActiveDirectorySettings
|
||||
{
|
||||
public ActiveDirectory()
|
||||
public ActiveDirectorySettings()
|
||||
{
|
||||
ActiveDirectoryDomain = ConfigurationManager.AppSettings["ActiveDirectoryDomain"];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@ namespace Umbraco.Core.Configuration
|
||||
|
||||
public ICoreDebug CoreDebug { get; } = new CoreDebug();
|
||||
public IMachineKeyConfig MachineKeyConfig { get; } = new MachineKeyConfig();
|
||||
public IIndexCreatorSettings IndexCreatorSettings { get; } = new IndexCreatorSettings();
|
||||
public INuCacheSettings NuCacheSettings { get; } = new NuCacheSettings();
|
||||
public ITypeFinderSettings TypeFinderSettings { get; } = new TypeFinderSettings();
|
||||
public IRuntimeSettings RuntimeSettings { get; } = new RuntimeSettings();
|
||||
public IActiveDirectorySettings ActiveDirectorySettings { get; } = new ActiveDirectorySettings();
|
||||
public IExceptionFilterSettings ExceptionFilterSettings { get; } = new ExceptionFilterSettings();
|
||||
|
||||
public IUmbracoSettingsSection UmbracoSettings { get; }
|
||||
|
||||
@@ -31,6 +37,16 @@ namespace Umbraco.Core.Configuration
|
||||
configs.Add(() => CoreDebug);
|
||||
configs.Add(() => MachineKeyConfig);
|
||||
configs.Add<IConnectionStrings>(() => new ConnectionStrings(ioHelper));
|
||||
configs.Add<IModelsBuilderConfig>(() => new ModelsBuilderConfig(ioHelper));
|
||||
|
||||
|
||||
configs.Add<IIndexCreatorSettings>(() => IndexCreatorSettings);
|
||||
configs.Add<INuCacheSettings>(() => NuCacheSettings);
|
||||
configs.Add<ITypeFinderSettings>(() => TypeFinderSettings);
|
||||
configs.Add<IRuntimeSettings>(() => RuntimeSettings);
|
||||
configs.Add<IActiveDirectorySettings>(() => ActiveDirectorySettings);
|
||||
configs.Add<IExceptionFilterSettings>(() => ExceptionFilterSettings);
|
||||
|
||||
configs.AddCoreConfigs(ioHelper);
|
||||
return configs;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Configuration
|
||||
private object _flagOutOfDateModelsLock;
|
||||
private bool _flagOutOfDateModelsConfigured;
|
||||
private bool _flagOutOfDateModels;
|
||||
public const string DefaultModelsNamespace = "Umbraco.Web.PublishedModels";
|
||||
|
||||
|
||||
public string DefaultModelsDirectory => _ioHelper.MapPath("~/App_Data/Models");
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Configuration
|
||||
Enable = ConfigurationManager.AppSettings[Prefix + "Enable"] == "true";
|
||||
|
||||
// ensure defaults are initialized for tests
|
||||
ModelsNamespace = DefaultModelsNamespace;
|
||||
ModelsNamespace = Constants.ModelsBuilder.DefaultModelsNamespace;
|
||||
ModelsDirectory = DefaultModelsDirectory;
|
||||
DebugLevel = 0;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Umbraco.Configuration
|
||||
Enable = enable;
|
||||
_modelsMode = modelsMode;
|
||||
|
||||
ModelsNamespace = string.IsNullOrWhiteSpace(modelsNamespace) ? DefaultModelsNamespace : modelsNamespace;
|
||||
ModelsNamespace = string.IsNullOrWhiteSpace(modelsNamespace) ? Constants.ModelsBuilder.DefaultModelsNamespace : modelsNamespace;
|
||||
EnableFactory = enableFactory;
|
||||
_flagOutOfDateModels = flagOutOfDateModels;
|
||||
ModelsDirectory = string.IsNullOrWhiteSpace(modelsDirectory) ? DefaultModelsDirectory : modelsDirectory;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines constants.
|
||||
/// </summary>
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines constants for ModelsBuilder.
|
||||
/// </summary>
|
||||
public static class ModelsBuilder
|
||||
{
|
||||
|
||||
public const string DefaultModelsNamespace = "Umbraco.Web.PublishedModels";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@
|
||||
/// The header name that angular uses to pass in the token to validate the cookie
|
||||
/// </summary>
|
||||
public const string AngularHeadername = "X-UMB-XSRF-TOKEN";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,6 @@ namespace Umbraco.Core.Composing.CompositionExtensions
|
||||
composition.RegisterUnique(factory => factory.GetInstance<IUmbracoSettingsSection>().RequestHandler);
|
||||
composition.RegisterUnique(factory => factory.GetInstance<IUmbracoSettingsSection>().Security);
|
||||
|
||||
composition.RegisterUnique<IIndexCreatorSettings, IndexCreatorSettings>();
|
||||
composition.RegisterUnique<INuCacheSettings, NuCacheSettings>();
|
||||
composition.RegisterUnique<ITypeFinderSettings, TypeFinderSettings>();
|
||||
composition.RegisterUnique<IRuntimeSettings, RuntimeSettings>();
|
||||
composition.RegisterUnique<IActiveDirectorySettings, IActiveDirectorySettings>();
|
||||
composition.RegisterUnique<IExceptionFilterSettings, ExceptionFilterSettings>();
|
||||
composition.RegisterUnique<IModelsBuilderConfig, ModelsBuilderConfig>();
|
||||
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Configuration\Umbraco.Configuration.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.BackOffice
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Hosting;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.ModelsBuilder.Embedded.Building;
|
||||
using Umbraco.Web.Editors;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Configuration;
|
||||
|
||||
namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
{
|
||||
@@ -19,6 +19,8 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
internal abstract class Builder
|
||||
{
|
||||
|
||||
|
||||
|
||||
private readonly IList<TypeModel> _typeModels;
|
||||
|
||||
protected Dictionary<string, string> ModelsMap { get; } = new Dictionary<string, string>();
|
||||
@@ -210,7 +212,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
|
||||
|
||||
// use configured else fallback to default
|
||||
return string.IsNullOrWhiteSpace(Config.ModelsNamespace)
|
||||
? ModelsBuilderConfig.DefaultModelsNamespace
|
||||
? Constants.ModelsBuilder.DefaultModelsNamespace
|
||||
: Config.ModelsNamespace;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Composing;
|
||||
@@ -20,16 +19,12 @@ namespace Umbraco.ModelsBuilder.Embedded.Compose
|
||||
{
|
||||
var isLegacyModelsBuilderInstalled = IsLegacyModelsBuilderInstalled();
|
||||
|
||||
|
||||
composition.Configs.Add<IModelsBuilderConfig>(() => new ModelsBuilderConfig(composition.IOHelper));
|
||||
|
||||
if (isLegacyModelsBuilderInstalled)
|
||||
{
|
||||
ComposeForLegacyModelsBuilder(composition);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
composition.Components().Append<ModelsBuilderComponent>();
|
||||
composition.Register<UmbracoServices>(Lifetime.Singleton);
|
||||
composition.RegisterUnique<ModelsGenerator>();
|
||||
|
||||
@@ -97,10 +97,6 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Configuration\Umbraco.Configuration.csproj">
|
||||
<Project>{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}</Project>
|
||||
<Name>Umbraco.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
|
||||
<Project>{29aa69d9-b597-4395-8d42-43b1263c240a}</Project>
|
||||
<Name>Umbraco.Core</Name>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Configuration;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.ModelsBuilder
|
||||
@@ -26,7 +27,7 @@ namespace Umbraco.Tests.ModelsBuilder
|
||||
public void DefaultModelsNamespace()
|
||||
{
|
||||
var config = new ModelsBuilderConfig(TestHelper.IOHelper);
|
||||
Assert.AreEqual(ModelsBuilderConfig.DefaultModelsNamespace, config.ModelsNamespace);
|
||||
Assert.AreEqual(Constants.ModelsBuilder.DefaultModelsNamespace, config.ModelsNamespace);
|
||||
}
|
||||
|
||||
[TestCase("c:/path/to/root", "~/dir/models", false, "c:\\path\\to\\root\\dir\\models")]
|
||||
|
||||
Reference in New Issue
Block a user