Moving classes to Infrastructure proj

This commit is contained in:
Elitsa Marinovska
2021-02-18 08:14:27 +01:00
parent 88acb07873
commit e74836cb48
21 changed files with 52 additions and 62 deletions

View File

@@ -1,8 +1,8 @@
using System;
using System;
using System.Reflection;
using Semver;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
/// <summary>
/// Manages API version handshake between client and server.
@@ -14,10 +14,7 @@ namespace Umbraco.ModelsBuilder.Embedded
/// </summary>
/// <param name="executingVersion">The currently executing version.</param>
/// <exception cref="ArgumentNullException"></exception>
internal ApiVersion(SemVersion executingVersion)
{
Version = executingVersion ?? throw new ArgumentNullException(nameof(executingVersion));
}
internal ApiVersion(SemVersion executingVersion) => Version = executingVersion ?? throw new ArgumentNullException(nameof(executingVersion));
private static SemVersion CurrentAssemblyVersion
=> SemVersion.Parse(Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);

View File

@@ -1,11 +1,11 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
// NOTE
// The idea was to have different types of builder, because I wanted to experiment with
@@ -30,7 +30,6 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
"System.Linq.Expressions",
"Umbraco.Core.Models.PublishedContent",
"Umbraco.Web.PublishedCache",
"Umbraco.ModelsBuilder.Embedded",
"Umbraco.Core"
};

View File

@@ -4,9 +4,8 @@ using Microsoft.Extensions.Options;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
public class ModelsGenerator
{
@@ -23,7 +22,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
_hostingEnvironment = hostingEnvironment;
}
internal void GenerateModels()
public void GenerateModels()
{
var modelsDirectory = _config.ModelsDirectoryAbsolute(_hostingEnvironment);
if (!Directory.Exists(modelsDirectory))

View File

@@ -1,7 +1,7 @@
using System;
using System;
using System.Collections.Generic;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
/// <summary>
/// Represents a model property.

View File

@@ -1,16 +1,16 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Umbraco.Core.Configuration.Models;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
/// <summary>
/// Implements a builder that works by writing text.
/// </summary>
internal class TextBuilder : Builder
public class TextBuilder : Builder
{
/// <summary>
/// Initializes a new instance of the <see cref="TextBuilder"/> class with a list of models to generate

View File

@@ -1,6 +1,6 @@
using System.Text;
using System.Text;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
internal static class TextHeaderWriter
{

View File

@@ -1,9 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
/// <summary>
/// Represents a model.

View File

@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Umbraco.Core;
namespace Umbraco.ModelsBuilder.Embedded.Building
namespace Umbraco.Infrastructure.ModelsBuilder.Building
{
internal class TypeModelHasher
public class TypeModelHasher
{
public static string Hash(IEnumerable<TypeModel> typeModels)
{

View File

@@ -0,0 +1,16 @@
using System;
namespace Umbraco.Infrastructure.ModelsBuilder
{
/// <summary>
/// Indicates that a property implements a given property alias.
/// </summary>
/// <remarks>And therefore it should not be generated.</remarks>
[AttributeUsage(AttributeTargets.Property /*, AllowMultiple = false, Inherited = false*/)]
public class ImplementPropertyTypeAttribute : Attribute
{
public ImplementPropertyTypeAttribute(string alias) => Alias = alias;
public string Alias { get; }
}
}

View File

@@ -6,11 +6,10 @@ using Umbraco.Configuration;
using Umbraco.Core;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Events;
using Umbraco.Extensions;
using Umbraco.ModelsBuilder.Embedded.Building;
using Umbraco.Infrastructure.ModelsBuilder.Building;
using Umbraco.Web.Cache;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
// supports LiveAppData - but not PureLive
public sealed class LiveModelsProvider : INotificationHandler<UmbracoApplicationStarting>, INotificationHandler<UmbracoRequestEnd>

View File

@@ -1,6 +1,6 @@
using System;
using System;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
/// <summary>
/// Indicates that an Assembly is a Models Builder assembly.

View File

@@ -2,7 +2,7 @@ using System;
using Umbraco.Core.Composing;
using Umbraco.Core.Dashboards;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
[Weight(40)]
public class ModelsBuilderDashboard : IDashboard

View File

@@ -6,7 +6,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
public sealed class ModelsGenerationError
{

View File

@@ -6,7 +6,7 @@ using Umbraco.Core.Events;
using Umbraco.Core.Hosting;
using Umbraco.Web.Cache;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
/// <summary>
/// Used to track if ModelsBuilder models are out of date/stale

View File

@@ -1,8 +1,8 @@
using System;
using System;
using System.Linq.Expressions;
using System.Reflection;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.ModelsBuilder.Embedded;
using Umbraco.Infrastructure.ModelsBuilder;
// same namespace as original Umbraco.Web PublishedElementExtensions
// ReSharper disable once CheckNamespace

View File

@@ -1,10 +1,10 @@
using System;
using System;
using System.Linq;
using System.Linq.Expressions;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.PublishedCache;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
/// <summary>
/// This is called from within the generated model classes

View File

@@ -7,7 +7,7 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
public class RoslynCompiler
{

View File

@@ -1,6 +1,6 @@
using System;
using System;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
internal static class TypeExtensions
{

View File

@@ -7,9 +7,9 @@ using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.ModelsBuilder.Embedded.Building;
using Umbraco.Infrastructure.ModelsBuilder.Building;
namespace Umbraco.ModelsBuilder.Embedded
namespace Umbraco.Infrastructure.ModelsBuilder
{
public sealed class UmbracoServices

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
@@ -12,6 +12,7 @@
<PackageReference Include="HtmlAgilityPack" Version="1.11.30" />
<PackageReference Include="MailKit" Version="2.10.1" />
<PackageReference Include="Markdown" Version="2.2.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />

View File

@@ -1,19 +0,0 @@
using System;
namespace Umbraco.ModelsBuilder.Embedded
{
/// <summary>
/// Indicates that a property implements a given property alias.
/// </summary>
/// <remarks>And therefore it should not be generated.</remarks>
[AttributeUsage(AttributeTargets.Property , AllowMultiple = false, Inherited = false)]
public class ImplementPropertyTypeAttribute : Attribute
{
public ImplementPropertyTypeAttribute(string alias)
{
Alias = alias;
}
public string Alias { get; private set; }
}
}