From 430b2c1adee7d7f08df523f7291b12d75c190665 Mon Sep 17 00:00:00 2001 From: Alexey Petryashev Date: Fri, 13 Dec 2024 16:33:20 +0300 Subject: [PATCH] # 8.0.0-beta.2 - switched all projects to dotnet 8, netstandard removed - removed reflection based dDI configuration - removed obsolete MicroElements.Functional dependency --- .../workflows/github_build_and_publish.yml | 2 +- .travis.yml | 10 --- CHANGELOG.md | 5 ++ MicroElements.Metadata.sln | 16 ---- common.props | 2 +- .../MicroElements.Metadata.SampleApp.csproj | 6 +- src/Directory.Build.props | 3 +- .../MicroElements.Diagnostics.csproj | 2 - .../DependencyInjectionExtensions.cs | 5 +- ...ReflectionDependencyInjectionExtensions.cs | 88 ++----------------- .../MicroElements.Metadata.AspNetCore.csproj | 4 +- .../PropertyContainerSchemaFilter.cs | 20 ++--- .../SwaggerConfigurationExtensions.cs | 58 +++++------- ...MicroElements.Metadata.Experimental.csproj | 4 +- ...croElements.Metadata.NewtonsoftJson.csproj | 2 - .../MicroElements.Metadata.OpenXml.csproj | 2 - ...croElements.Metadata.SystemTextJson.csproj | 6 -- .../MicroElements.Metadata.Xml.csproj | 2 - .../MicroElements.Metadata.csproj | 2 - .../MicroElements.Metadata.Benchmarks.csproj | 2 - .../AutoFixture/PropertyContainerBuilder.cs | 2 +- .../Diagnostics/MessageTemplateTests.cs | 1 + .../Diagnostics/MessageTests.cs | 5 +- .../ExcelBuilder/ExcelBuilderTests.cs | 2 +- .../MicroElements.Metadata.Tests.csproj | 2 - version.props | 2 +- 26 files changed, 59 insertions(+), 196 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/github_build_and_publish.yml b/.github/workflows/github_build_and_publish.yml index c6ceef2..a69e4f3 100644 --- a/.github/workflows/github_build_and_publish.yml +++ b/.github/workflows/github_build_and_publish.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.300 + dotnet-version: 8.0.404 #------------------------------- - name: Build and Publish env: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 04aab56..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -dist: xenial -language: csharp -mono: none -dotnet: 3.1 -os: - - linux -before_script: - - chmod a+x ./build.sh -script: - - ./build.sh --target=Travis --verbosity=normal --ForceUploadPackages=false diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6b7ef..5f6cc73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 8.0.0-beta.2 +- switched all projects to dotnet 8, netstandard removed +- removed reflection based dDI configuration +- removed obsolete MicroElements.Functional dependency + # 8.0.0-beta.1 - MicroElements.Functional dependency removed - MicroElements.Diagnostics extracted diff --git a/MicroElements.Metadata.sln b/MicroElements.Metadata.sln index 8bea6e1..bb808d1 100644 --- a/MicroElements.Metadata.sln +++ b/MicroElements.Metadata.sln @@ -14,7 +14,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3324E7E9-251C-4996-AF33-AAF79DC681A9}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - .travis.yml = .travis.yml build.sh = build.sh CHANGELOG.md = CHANGELOG.md common.props = common.props @@ -50,8 +49,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroElements.Metadata.Expe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroElements.Diagnostics", "src\MicroElements.Diagnostics\MicroElements.Diagnostics.csproj", "{63B52079-9574-4145-B6DC-2ED0B3F1BDF4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroElements.Metadata.Functional", "src\MicroElements.Metadata.Functional\MicroElements.Metadata.Functional.csproj", "{C41680FB-C814-4533-AD9E-011973376B1C}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -218,18 +215,6 @@ Global {63B52079-9574-4145-B6DC-2ED0B3F1BDF4}.Release|x64.Build.0 = Release|Any CPU {63B52079-9574-4145-B6DC-2ED0B3F1BDF4}.Release|x86.ActiveCfg = Release|Any CPU {63B52079-9574-4145-B6DC-2ED0B3F1BDF4}.Release|x86.Build.0 = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|x64.ActiveCfg = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|x64.Build.0 = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|x86.ActiveCfg = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Debug|x86.Build.0 = Debug|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|Any CPU.Build.0 = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|x64.ActiveCfg = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|x64.Build.0 = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|x86.ActiveCfg = Release|Any CPU - {C41680FB-C814-4533-AD9E-011973376B1C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -248,7 +233,6 @@ Global {81C38035-F801-4CCB-A5A2-BAD92CBF9730} = {BC47333A-FBE7-4A16-849A-709C6EBF7D40} {D45D2A84-7725-4DD1-9218-4DD0C0DF56EA} = {39CBC28C-A189-4A8B-A5A0-EB4F89A684CF} {63B52079-9574-4145-B6DC-2ED0B3F1BDF4} = {39CBC28C-A189-4A8B-A5A0-EB4F89A684CF} - {C41680FB-C814-4533-AD9E-011973376B1C} = {39CBC28C-A189-4A8B-A5A0-EB4F89A684CF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {58329F1B-0ADB-47A5-8677-7D0C87788051} diff --git a/common.props b/common.props index b610b7a..f3dbf3b 100644 --- a/common.props +++ b/common.props @@ -2,7 +2,7 @@ MicroElements.Metadata - 2023 + 2025 alexey.petriashev, MicroElements Metadata model, parsing, validation and reporting. diff --git a/sample/MicroElements.Metadata.SampleApp/MicroElements.Metadata.SampleApp.csproj b/sample/MicroElements.Metadata.SampleApp/MicroElements.Metadata.SampleApp.csproj index 008c0ed..bb33742 100644 --- a/sample/MicroElements.Metadata.SampleApp/MicroElements.Metadata.SampleApp.csproj +++ b/sample/MicroElements.Metadata.SampleApp/MicroElements.Metadata.SampleApp.csproj @@ -2,14 +2,12 @@ net8.0 - 9.0 - enable true - - + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 25433df..eb0aa80 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -9,7 +9,8 @@ true true true - 9.0 + latest + enable diff --git a/src/MicroElements.Diagnostics/MicroElements.Diagnostics.csproj b/src/MicroElements.Diagnostics/MicroElements.Diagnostics.csproj index 076ce51..71ae156 100644 --- a/src/MicroElements.Diagnostics/MicroElements.Diagnostics.csproj +++ b/src/MicroElements.Diagnostics/MicroElements.Diagnostics.csproj @@ -5,8 +5,6 @@ net8.0 MicroElements - 9.0 - enable diff --git a/src/MicroElements.Metadata.AspNetCore/AspNetCore/DependencyInjectionExtensions.cs b/src/MicroElements.Metadata.AspNetCore/AspNetCore/DependencyInjectionExtensions.cs index 91ef09b..3a36efe 100644 --- a/src/MicroElements.Metadata.AspNetCore/AspNetCore/DependencyInjectionExtensions.cs +++ b/src/MicroElements.Metadata.AspNetCore/AspNetCore/DependencyInjectionExtensions.cs @@ -7,6 +7,7 @@ using MicroElements.Metadata.Serialization; using MicroElements.Metadata.Swashbuckle; using MicroElements.Metadata.SystemTextJson; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Swashbuckle.AspNetCore.SwaggerGen; @@ -55,7 +56,7 @@ public static IServiceCollection AddMetadata( // Register ISerializerDataContractResolver (if not registered already) services.TryAddTransient(provider => { - var serializerOptions = provider.GetJsonSerializerOptions() ?? new JsonSerializerOptions(); + var serializerOptions = provider.GetJsonSerializerOptionsOrDefault(); return new JsonSerializerDataContractResolver(serializerOptions); }); @@ -109,7 +110,7 @@ ServiceDescriptor CreateServiceDescriptor(Func func) } /// - /// AspNetCore MVC JsonOptions.Value wrapper that can be used in netstandard. + /// AspNetCore MVC JsonOptions. Value wrapper that can be used in netstandard. /// public class AspNetJsonSerializerOptions { diff --git a/src/MicroElements.Metadata.AspNetCore/AspNetCore/ReflectionDependencyInjectionExtensions.cs b/src/MicroElements.Metadata.AspNetCore/AspNetCore/ReflectionDependencyInjectionExtensions.cs index 2573363..8c5452e 100644 --- a/src/MicroElements.Metadata.AspNetCore/AspNetCore/ReflectionDependencyInjectionExtensions.cs +++ b/src/MicroElements.Metadata.AspNetCore/AspNetCore/ReflectionDependencyInjectionExtensions.cs @@ -2,105 +2,33 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.Linq; -using System.Reflection; using System.Text.Json; -using MicroElements.Reflection; -using MicroElements.Reflection.TypeCaching; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; namespace MicroElements.Metadata.AspNetCore { /// - /// DependencyInjection through Reflection. + /// DependencyInjection. /// public static class ReflectionDependencyInjectionExtensions { - private static readonly Lazy AppDomainTypeCache = new(() => new TypeCache(AssemblySource.AppDomain.LoadTypes(TypeFilters.AllPublicTypes))); - private static readonly Func GetByFullName = typeName => AppDomainTypeCache.Value.GetType(typeName); - - /// - /// Calls through reflection: services.Configure<JsonOptions>(options => configureJson(options));. - /// Can be used from netstandard. - /// - /// Services. - /// Action to configure in JsonOptions. public static void ConfigureJsonOptionsForAspNetCore(this IServiceCollection services, Action configureJson) { - Action configureJsonOptionsUntyped = options => - { - PropertyInfo? propertyInfo = options.GetType().GetProperty("JsonSerializerOptions"); - - if (propertyInfo?.GetValue(options) is JsonSerializerOptions jsonSerializerOptions) - { - configureJson(jsonSerializerOptions); - } - }; - - Type? jsonOptionsType = GetByFullName("Microsoft.AspNetCore.Mvc.JsonOptions"); - if (jsonOptionsType != null) - { - Type? extensionsType = GetByFullName("Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions"); - - MethodInfo? configureMethodGeneric = extensionsType - ?.GetTypeInfo() - .DeclaredMethods - .FirstOrDefault(info => info.Name == "Configure" && info.GetParameters().Length == 2); - - MethodInfo? configureMethod = configureMethodGeneric?.MakeGenericMethod(jsonOptionsType); - - if (configureMethod != null) - { - // services.Configure(options => configureJson(options)); - configureMethod.Invoke(services, new object?[] { services, configureJsonOptionsUntyped }); - } - } + services.Configure(options => configureJson(options.JsonSerializerOptions)); } - /// - /// Gets from JsonOptions registered in AspNetCore. - /// Uses reflection to call code: - /// serviceProvider.GetService<IOptions<JsonOptions>>()?.Value?.JsonSerializerOptions; - /// - /// Source service provider. - /// Optional . - public static JsonSerializerOptions? GetJsonSerializerOptions(this IServiceProvider serviceProvider) + public static void ConfigureJsonOptionsForMinimalApi(this IServiceCollection services, Action configureJson) { - JsonSerializerOptions? jsonSerializerOptions = null; - - Type? jsonOptionsType = GetByFullName("Microsoft.AspNetCore.Mvc.JsonOptions"); - if (jsonOptionsType != null) - { - // IOptions - Type jsonOptionsInterfaceType = typeof(IOptions<>).MakeGenericType(jsonOptionsType); - object? jsonOptionsOption = serviceProvider.GetService(jsonOptionsInterfaceType); - - if (jsonOptionsOption != null) - { - PropertyInfo? valueProperty = jsonOptionsInterfaceType.GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); - PropertyInfo? jsonSerializerOptionsProperty = jsonOptionsType.GetProperty("JsonSerializerOptions", BindingFlags.Instance | BindingFlags.Public); - - if (valueProperty != null && jsonSerializerOptionsProperty != null) - { - // JsonOptions - var jsonOptions = valueProperty.GetValue(jsonOptionsOption); - - // JsonSerializerOptions - if (jsonOptions != null) - { - jsonSerializerOptions = jsonSerializerOptionsProperty.GetValue(jsonOptions) as JsonSerializerOptions; - } - } - } - } - - return jsonSerializerOptions; + services.ConfigureHttpJsonOptions(options => configureJson(options.SerializerOptions)); } public static JsonSerializerOptions GetJsonSerializerOptionsOrDefault(this IServiceProvider serviceProvider) { - return serviceProvider.GetJsonSerializerOptions() ?? new JsonSerializerOptions(); + return serviceProvider.GetService>()?.Value.JsonSerializerOptions + ?? serviceProvider.GetService>()?.Value.SerializerOptions + ?? new JsonSerializerOptions(); } } } diff --git a/src/MicroElements.Metadata.AspNetCore/MicroElements.Metadata.AspNetCore.csproj b/src/MicroElements.Metadata.AspNetCore/MicroElements.Metadata.AspNetCore.csproj index a256ec4..aec3a55 100644 --- a/src/MicroElements.Metadata.AspNetCore/MicroElements.Metadata.AspNetCore.csproj +++ b/src/MicroElements.Metadata.AspNetCore/MicroElements.Metadata.AspNetCore.csproj @@ -5,12 +5,10 @@ net8.0 MicroElements.Metadata - 9.0 - enable - + diff --git a/src/MicroElements.Metadata.AspNetCore/Swashbuckle/PropertyContainerSchemaFilter.cs b/src/MicroElements.Metadata.AspNetCore/Swashbuckle/PropertyContainerSchemaFilter.cs index 67383ba..0ceaf97 100644 --- a/src/MicroElements.Metadata.AspNetCore/Swashbuckle/PropertyContainerSchemaFilter.cs +++ b/src/MicroElements.Metadata.AspNetCore/Swashbuckle/PropertyContainerSchemaFilter.cs @@ -7,10 +7,10 @@ using System.Reflection; using System.Text.Json; using MicroElements.Metadata.AspNetCore; -using MicroElements.Metadata.ComponentModel; using MicroElements.Metadata.JsonSchema; using MicroElements.Metadata.Schema; using MicroElements.Reflection.TypeExtensions; +using Microsoft.Extensions.Options; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -23,7 +23,7 @@ namespace MicroElements.Metadata.Swashbuckle /// public class PropertyContainerSchemaFilter : ISchemaFilter { - private readonly PropertyContainerSchemaFilterOptions _options; + private readonly IOptions _options; private readonly JsonSerializerOptions _serializerOptions; private readonly SchemaGeneratorOptions _schemaGeneratorOptions; @@ -34,19 +34,13 @@ public class PropertyContainerSchemaFilter : ISchemaFilter /// JsonSerializerOptions. /// Swagger generator options. public PropertyContainerSchemaFilter( - PropertyContainerSchemaFilterOptions? options, + IOptions? options, AspNetJsonSerializerOptions serializerOptions, SwaggerGenOptions generatorOptions) { - _options = options?.Clone() ?? new PropertyContainerSchemaFilterOptions(); + _options = options ?? new OptionsWrapper(new PropertyContainerSchemaFilterOptions()); _serializerOptions = serializerOptions.Value; _schemaGeneratorOptions = generatorOptions.SchemaGeneratorOptions; - - Func? resolvePropertyName = options?.ResolvePropertyName; - resolvePropertyName ??= propertyName => _serializerOptions.PropertyNamingPolicy.ConvertName(propertyName); - resolvePropertyName ??= propertyName => propertyName; - - _options.ResolvePropertyName = resolvePropertyName; } /// @@ -72,7 +66,7 @@ public void Apply(OpenApiSchema schema, SchemaFilterContext context) } // "$ref": "#/components/schemas/KnownSchema" - if (_options.GenerateKnownSchemasAsRefs && propertySet != null) + if (_options.Value.GenerateKnownSchemasAsRefs && propertySet != null) { knownSchemaType ??= propertySet.GetType(); string knownSchemaId = _schemaGeneratorOptions.SchemaIdSelector(knownSchemaType); @@ -126,7 +120,7 @@ private void FillObjectSchema(OpenApiSchema schema, SchemaFilterContext context, if (property.GetOrEvaluateNullability() is { } allowNull) propertySchema.Nullable = allowNull.IsNullAllowed; - if (_options.GenerateKnownSchemasAsRefs && property.GetSchema() is { } separateSchema) + if (_options.Value.GenerateKnownSchemasAsRefs && property.GetSchema() is { } separateSchema) { string knownSchemaId = separateSchema.Name; @@ -163,7 +157,7 @@ private void FillObjectSchema(OpenApiSchema schema, SchemaFilterContext context, propertySchema = FillDataSchema(propertySchema, property); } - string? propertyName = _options.ResolvePropertyName!(property.Name); + string propertyName = _options.Value.ResolvePropertyName!(property.Name); schema.Properties.Add(propertyName, propertySchema); } diff --git a/src/MicroElements.Metadata.AspNetCore/Swashbuckle/SwaggerConfigurationExtensions.cs b/src/MicroElements.Metadata.AspNetCore/Swashbuckle/SwaggerConfigurationExtensions.cs index 8ed96c9..0bfbf8e 100644 --- a/src/MicroElements.Metadata.AspNetCore/Swashbuckle/SwaggerConfigurationExtensions.cs +++ b/src/MicroElements.Metadata.AspNetCore/Swashbuckle/SwaggerConfigurationExtensions.cs @@ -44,55 +44,37 @@ public static void ConfigureSwaggerForPropertyContainers( this IServiceCollection services, Action? configure = null) { + services.ConfigureOptions(); if (configure != null) - { services.Configure(configure); - services.TryAddTransient(provider => - { - var options = provider.GetService>(); - return options?.Value ?? new PropertyContainerSchemaFilterOptions(); - }); - } - else - { - services.TryAddTransient(provider => - { - JsonSerializerOptions? jsonSerializerOptions = provider.GetJsonSerializerOptions(); - - // Configure json serializer - jsonSerializerOptions?.ConfigureJsonForPropertyContainers(); - - var schemaFilterOptions = new PropertyContainerSchemaFilterOptions(); - schemaFilterOptions.ConfigureFromJsonOptions(jsonSerializerOptions); - - return schemaFilterOptions; - }); - } - // Configure swagger services.ConfigureSwaggerGen(swagger => swagger.ConfigureForPropertyContainers()); } + } - /// - /// Configures from . - /// - /// Options to configure. - /// JsonSerializerOptions. - /// The same options. - public static PropertyContainerSchemaFilterOptions ConfigureFromJsonOptions( - this PropertyContainerSchemaFilterOptions options, - JsonSerializerOptions? jsonOptions) + internal sealed class ConfigurePropertyContainerSchemaFilterOptions(IServiceProvider serviceProvider) + : IConfigureNamedOptions + { + /// + public void Configure(PropertyContainerSchemaFilterOptions options) { - options.ResolvePropertyName = jsonOptions.ResolvePropertyNameByJsonSerializerOptions; - return options; + throw new NotImplementedException(); } - private static string ResolvePropertyNameByJsonSerializerOptions(this JsonSerializerOptions? jsonOptions, string propertyName) + /// + public void Configure(string? name, PropertyContainerSchemaFilterOptions options) { - return jsonOptions is { PropertyNamingPolicy: { } propertyNamingPolicy } - ? propertyNamingPolicy.ConvertName(propertyName) - : propertyName; + JsonSerializerOptions jsonOptions = serviceProvider.GetJsonSerializerOptionsOrDefault(); + options.ResolvePropertyName = ResolvePropertyName; + + string ResolvePropertyName(string propertyName) + { + string resolvedPropertyName = jsonOptions is { PropertyNamingPolicy: { } propertyNamingPolicy } + ? propertyNamingPolicy.ConvertName(propertyName) + : propertyName; + return resolvedPropertyName; + } } } } diff --git a/src/MicroElements.Metadata.Experimental/MicroElements.Metadata.Experimental.csproj b/src/MicroElements.Metadata.Experimental/MicroElements.Metadata.Experimental.csproj index 7f18ebc..ec65717 100644 --- a/src/MicroElements.Metadata.Experimental/MicroElements.Metadata.Experimental.csproj +++ b/src/MicroElements.Metadata.Experimental/MicroElements.Metadata.Experimental.csproj @@ -1,9 +1,9 @@ - + - net6.0 + net8.0 enable diff --git a/src/MicroElements.Metadata.NewtonsoftJson/MicroElements.Metadata.NewtonsoftJson.csproj b/src/MicroElements.Metadata.NewtonsoftJson/MicroElements.Metadata.NewtonsoftJson.csproj index 5b770a3..2993569 100644 --- a/src/MicroElements.Metadata.NewtonsoftJson/MicroElements.Metadata.NewtonsoftJson.csproj +++ b/src/MicroElements.Metadata.NewtonsoftJson/MicroElements.Metadata.NewtonsoftJson.csproj @@ -5,8 +5,6 @@ net8.0 MicroElements.Metadata - 8.0 - enable diff --git a/src/MicroElements.Metadata.OpenXml/MicroElements.Metadata.OpenXml.csproj b/src/MicroElements.Metadata.OpenXml/MicroElements.Metadata.OpenXml.csproj index 4c4b54c..d5ca721 100644 --- a/src/MicroElements.Metadata.OpenXml/MicroElements.Metadata.OpenXml.csproj +++ b/src/MicroElements.Metadata.OpenXml/MicroElements.Metadata.OpenXml.csproj @@ -5,8 +5,6 @@ net8.0 MicroElements.Metadata - 9.0 - enable diff --git a/src/MicroElements.Metadata.SystemTextJson/MicroElements.Metadata.SystemTextJson.csproj b/src/MicroElements.Metadata.SystemTextJson/MicroElements.Metadata.SystemTextJson.csproj index 671e17e..2a357d0 100644 --- a/src/MicroElements.Metadata.SystemTextJson/MicroElements.Metadata.SystemTextJson.csproj +++ b/src/MicroElements.Metadata.SystemTextJson/MicroElements.Metadata.SystemTextJson.csproj @@ -5,14 +5,8 @@ net8.0 MicroElements.Metadata - 9.0 - enable - - - - diff --git a/src/MicroElements.Metadata.Xml/MicroElements.Metadata.Xml.csproj b/src/MicroElements.Metadata.Xml/MicroElements.Metadata.Xml.csproj index 6656dc5..58c0d7e 100644 --- a/src/MicroElements.Metadata.Xml/MicroElements.Metadata.Xml.csproj +++ b/src/MicroElements.Metadata.Xml/MicroElements.Metadata.Xml.csproj @@ -5,8 +5,6 @@ net8.0 MicroElements.Metadata - 9.0 - enable diff --git a/src/MicroElements.Metadata/MicroElements.Metadata.csproj b/src/MicroElements.Metadata/MicroElements.Metadata.csproj index d1a0133..7135473 100644 --- a/src/MicroElements.Metadata/MicroElements.Metadata.csproj +++ b/src/MicroElements.Metadata/MicroElements.Metadata.csproj @@ -5,8 +5,6 @@ net8.0 MicroElements - 10 - enable diff --git a/test/MicroElements.Metadata.Benchmarks/MicroElements.Metadata.Benchmarks.csproj b/test/MicroElements.Metadata.Benchmarks/MicroElements.Metadata.Benchmarks.csproj index f3806d3..380ca63 100644 --- a/test/MicroElements.Metadata.Benchmarks/MicroElements.Metadata.Benchmarks.csproj +++ b/test/MicroElements.Metadata.Benchmarks/MicroElements.Metadata.Benchmarks.csproj @@ -3,8 +3,6 @@ Exe net8.0 - 9.0 - enable diff --git a/test/MicroElements.Metadata.Tests/AutoFixture/PropertyContainerBuilder.cs b/test/MicroElements.Metadata.Tests/AutoFixture/PropertyContainerBuilder.cs index 0a566d3..669b7d3 100644 --- a/test/MicroElements.Metadata.Tests/AutoFixture/PropertyContainerBuilder.cs +++ b/test/MicroElements.Metadata.Tests/AutoFixture/PropertyContainerBuilder.cs @@ -19,7 +19,7 @@ public object Create(object request, ISpecimenContext context) throw new ArgumentNullException(nameof(context)); } - if (request is Type type && type.IsAssignableTo()) + if (request is Type type && type.IsAssignableTo(typeof(IPropertyContainer))) { IPropertySet knownPropertySet = type.GetSchemaByKnownPropertySet(); diff --git a/test/MicroElements.Metadata.Tests/Diagnostics/MessageTemplateTests.cs b/test/MicroElements.Metadata.Tests/Diagnostics/MessageTemplateTests.cs index bd3cd03..f40a6cf 100644 --- a/test/MicroElements.Metadata.Tests/Diagnostics/MessageTemplateTests.cs +++ b/test/MicroElements.Metadata.Tests/Diagnostics/MessageTemplateTests.cs @@ -1,5 +1,6 @@ using System; using FluentAssertions; +using MicroElements.Diagnostics; using Xunit; namespace MicroElements.Functional.Tests diff --git a/test/MicroElements.Metadata.Tests/Diagnostics/MessageTests.cs b/test/MicroElements.Metadata.Tests/Diagnostics/MessageTests.cs index 5fef2fa..0a0ca8d 100644 --- a/test/MicroElements.Metadata.Tests/Diagnostics/MessageTests.cs +++ b/test/MicroElements.Metadata.Tests/Diagnostics/MessageTests.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.Serialization.Formatters.Binary; using FluentAssertions; +using MicroElements.Diagnostics; using MicroElements.Metadata; using Xunit; @@ -28,8 +29,8 @@ public void Test2() .WithProperty("Elapsed", 145); message.FormattedMessage.Should().Be("User Alex created in 145 ms."); - message.GetProperty("Name").GetValueOrThrow().Should().Be("Alex"); - message.GetProperty("Elapsed").GetValueOrThrow().Should().Be(145); + message.GetValueOrDefault("Name").Should().Be("Alex"); + message.GetValueOrDefault("Elapsed").Should().Be(145); } [Fact] diff --git a/test/MicroElements.Metadata.Tests/ExcelBuilder/ExcelBuilderTests.cs b/test/MicroElements.Metadata.Tests/ExcelBuilder/ExcelBuilderTests.cs index 9f4961d..6ca64a5 100644 --- a/test/MicroElements.Metadata.Tests/ExcelBuilder/ExcelBuilderTests.cs +++ b/test/MicroElements.Metadata.Tests/ExcelBuilder/ExcelBuilderTests.cs @@ -131,7 +131,7 @@ public void date_precision() public void MapToSerialAndBack(T initial, Func fromDateTime) { - T restored = Prelude + T restored = Parser .ParseDouble(initial.ToExcelSerialDateAsString()) .Map(d => d.FromExcelSerialDate()) .Map(fromDateTime) diff --git a/test/MicroElements.Metadata.Tests/MicroElements.Metadata.Tests.csproj b/test/MicroElements.Metadata.Tests/MicroElements.Metadata.Tests.csproj index 4a0b56d..7104b57 100644 --- a/test/MicroElements.Metadata.Tests/MicroElements.Metadata.Tests.csproj +++ b/test/MicroElements.Metadata.Tests/MicroElements.Metadata.Tests.csproj @@ -2,7 +2,6 @@ net8.0 - enable false @@ -28,7 +27,6 @@ - diff --git a/version.props b/version.props index 7ba4351..ca66f9a 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@ 8.0.0 - beta.1 + beta.2