NetCore: MSDI refactor split CoreRuntime & Remove Current (#9356)

* Split Bootstrap code from CoreRuntime

* Make ContentService method signatures match interface
prevents need to hide the concrete class in tests

* Remove Current

Only bit that bugs me is TreeNode for IconFilePath
I get the feeling it's dead code, but can just use a setter in cs or work out path in js if required.

* Fix tests, remember to terminate IRuntime
This commit is contained in:
Paul Johnson
2020-11-10 08:50:47 +00:00
committed by GitHub
parent 190ff2ae6d
commit 3f5f85880e
50 changed files with 563 additions and 691 deletions

View File

@@ -2,8 +2,10 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Umbraco.Composing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Core;
using Umbraco.Core.Configuration.Models;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -33,8 +35,9 @@ namespace Umbraco.Web.Models.ContentEditing
if (UserGroups.Any() == false)
yield return new ValidationResult("A user must be assigned to at least one group", new[] { nameof(UserGroups) });
// TODO: this will need another way of retrieving this setting if and when Configs are removed from Current.
if (Current.SecuritySettings.UsernameIsEmail == false && Username.IsNullOrWhiteSpace())
var securitySettings = validationContext.GetRequiredService<IOptions<SecuritySettings>>();
if (securitySettings.Value.UsernameIsEmail == false && Username.IsNullOrWhiteSpace())
yield return new ValidationResult("A username cannot be empty", new[] { nameof(Username) });
}
}