Use c#9 + namespace fix

This commit is contained in:
Bjarke Berg
2021-03-02 16:20:44 +01:00
parent c1f14de943
commit 1c50ece986
23 changed files with 33 additions and 31 deletions

View File

@@ -77,7 +77,7 @@ namespace Umbraco.Cms.Core
return;
}
if (!(o is T value))
if (o is not T value)
{
throw new ArgumentException($"Expected type {typeof(T).FullName}, got {o.GetType().FullName}", nameof(o));
}

View File

@@ -1,4 +1,4 @@
namespace Umbraco.Core.Security
namespace Umbraco.Cms.Core.Security
{
/// <summary>
/// Creates and manages <see cref="IBackOfficeSecurity"/> instances.

View File

@@ -2,13 +2,8 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>
<RootNamespace>Umbraco.Cms.Core</RootNamespace>
<AssemblyVersion>0.5.0</AssemblyVersion>
<InformationalVersion>0.5.0</InformationalVersion>
<FileVersion>0.5.0</FileVersion>
<Product>Umbraco CMS</Product>
<RootNamespace>Umbraco.Core</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

View File

@@ -4,7 +4,6 @@
<TargetFramework>net472</TargetFramework>
<RootNamespace>Umbraco.Cms.Infrastructure.Examine</RootNamespace>
<Product>Umbraco CMS</Product>
<RootNamespace>Umbraco.Examine</RootNamespace>
<Title>Umbraco.Examine.Lucene</Title>
</PropertyGroup>

View File

@@ -12,7 +12,6 @@ using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
using Umbraco.Cms.Core.Web;
using Umbraco.Core.Security;
namespace Umbraco.Cms.Infrastructure.HostedServices
{

View File

@@ -80,6 +80,7 @@ _hostingEnvironment = hostingEnvironment;
{
db = _dbFactory.CreateDatabase();
_hasTable = db.HasTable(Cms.Core.Constants.DatabaseSchema.Tables.KeyValue);
if (!_hasTable)
{

View File

@@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>
<RootNamespace>Umbraco.Cms.Infrastructure</RootNamespace>
</PropertyGroup>

View File

@@ -3,8 +3,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Umbraco.Cms.Infrastructure.PublishedCache</RootNamespace>
<LangVersion>8</LangVersion>
<RootNamespace>Umbraco.Infrastructure.PublishedCache</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

View File

@@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<RootNamespace>Umbraco.Cms.Tests.Common</RootNamespace>
</PropertyGroup>

View File

@@ -14,9 +14,11 @@ using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.DependencyInjection;
@@ -24,9 +26,7 @@ using Umbraco.Cms.Tests.Integration.Testing;
using Umbraco.Cms.Web.BackOffice.Controllers;
using Umbraco.Cms.Web.Common.Controllers;
using Umbraco.Cms.Web.Website.Controllers;
using Umbraco.Core.Security;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Tests.Integration.TestServerTest
{

View File

@@ -25,6 +25,7 @@ using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Core.Web;
@@ -36,9 +37,7 @@ using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.DependencyInjection;
using Umbraco.Cms.Tests.Integration.Extensions;
using Umbraco.Cms.Tests.Integration.Implementations;
using Umbraco.Core.Security;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Tests.Integration.Testing
{

View File

@@ -4,7 +4,6 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>8</LangVersion>
<RootNamespace>Umbraco.Cms.Tests.Integration</RootNamespace>
</PropertyGroup>

View File

@@ -16,6 +16,7 @@ using Umbraco.Cms.Core.Mapping;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
@@ -24,7 +25,6 @@ using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
using Umbraco.Cms.Web.BackOffice.Filters;
using Umbraco.Cms.Web.BackOffice.ModelBinders;
using Umbraco.Core.Security;
using Umbraco.Extensions;
using DataType = Umbraco.Cms.Core.Models.DataType;

View File

@@ -8,12 +8,12 @@ using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Runtime;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Infrastructure;
using Umbraco.Cms.Infrastructure.HostedServices;
using Umbraco.Core.Security;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Infrastructure.HostedServices
{

View File

@@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>latest</LangVersion>
<RootNamespace>Umbraco.Cms.Web.BackOffice</RootNamespace>
</PropertyGroup>

View File

@@ -53,7 +53,6 @@ using Umbraco.Cms.Web.Common.Routing;
using Umbraco.Cms.Web.Common.Security;
using Umbraco.Cms.Web.Common.Templates;
using Umbraco.Cms.Web.Common.UmbracoContext;
using Umbraco.Core.Security;
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
namespace Umbraco.Extensions

View File

@@ -353,13 +353,12 @@ namespace Umbraco.Cms.Web.Common.Macros
return Attempt.Fail(new MacroContent { Text = "[macro failed (no content)]" });
}
ILocalizedTextService textService = _textService;
return ExecuteMacroWithErrorWrapper(model,
$"Executing PartialView: MacroSource=\"{model.MacroSource}\".",
"Executed PartialView.",
() => _partialViewMacroEngine.Execute(model, content),
() => textService.Localize("errors/macroErrorLoadingPartialView", new[] { model.MacroSource }));
() => _textService.Localize("errors/macroErrorLoadingPartialView", new[] { model.MacroSource }));
}

View File

@@ -14,7 +14,6 @@ using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Infrastructure.PublishedCache;
using Umbraco.Cms.Web.Common.Profiler;
using Umbraco.Core.Security;
using Umbraco.Extensions;
namespace Umbraco.Cms.Web.Common.Middleware

View File

@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Core.Security;
namespace Umbraco.Cms.Web.Common.Security
{

View File

@@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>latest</LangVersion>
<RootNamespace>Umbraco.Cms.Web.Common</RootNamespace>
</PropertyGroup>

View File

@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Web;
namespace Umbraco.Cms.Web.UI.NetCore
{
public class BergViewComponent : ViewComponent
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
public BergViewComponent(IUmbracoContextAccessor umbracoContextAccessor)
{
_umbracoContextAccessor = umbracoContextAccessor;
}
public IViewComponentResult Invoke()
{
TempData["BERG"] = "coool";
var currentPage = _umbracoContextAccessor.UmbracoContext.PublishedRequest?.PublishedContent;
return View(currentPage);
}
}
}

View File

@@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Umbraco.Cms.Web.UI.NetCore</RootNamespace>
<LangVersion>latest</LangVersion>
<RootNamespace>Umbraco.Cms.Web.UI.NetCore</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -22,7 +21,6 @@
<ItemGroup>
<Folder Include="App_Plugins" />
<Folder Include="Views" />
<Folder Include="wwwroot\Media" />
</ItemGroup>

View File

@@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>latest</LangVersion>
<RootNamespace>Umbraco.Cms.Web.Website</RootNamespace>
</PropertyGroup>