From 9edeec58afebde44b879ac51c3aae538d61def96 Mon Sep 17 00:00:00 2001 From: Temo Nikolaishvili Date: Thu, 4 Apr 2024 20:58:43 +0400 Subject: [PATCH] using statements were missing in DomainPrimitives generated file --- Directory.Build.props | 2 +- src/AltaSoft.DomainPrimitives.Generator/Executor.cs | 8 +------- .../Helpers/MethodGeneratorHelper.cs | 1 + 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9ecd41d..5ff9a6c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@ Domain Primitives ALTA Software llc. Copyright © 2024 ALTA Software llc. - 2.2.0 + 2.2.1 diff --git a/src/AltaSoft.DomainPrimitives.Generator/Executor.cs b/src/AltaSoft.DomainPrimitives.Generator/Executor.cs index d5d5170..ecf3511 100644 --- a/src/AltaSoft.DomainPrimitives.Generator/Executor.cs +++ b/src/AltaSoft.DomainPrimitives.Generator/Executor.cs @@ -410,7 +410,7 @@ private static void Process(GeneratorData data, string ctorCode, DomainPrimitive } var builder = new SourceCodeBuilder(); - var usings = new List(3) { "System", "System.Numerics", "System.Diagnostics", "System.Runtime.CompilerServices" }; + var usings = new List(3) { "System", "System.Numerics", "System.Diagnostics", "System.Runtime.CompilerServices", "AltaSoft.DomainPrimitives" }; if (data.ParentSymbols.Count > 0) { @@ -438,7 +438,6 @@ private static void Process(GeneratorData data, string ctorCode, DomainPrimitive usings.Add("System.Xml"); usings.Add("System.Xml.Schema"); usings.Add("System.Xml.Serialization"); - usings.Add("AltaSoft.DomainPrimitives"); } var needsMathOperators = data.GenerateAdditionOperators || data.GenerateDivisionOperators || @@ -446,11 +445,6 @@ private static void Process(GeneratorData data, string ctorCode, DomainPrimitive var isByteOrShort = data.ParentSymbols.Count == 0 && data.UnderlyingType.IsByteOrShort(); - if ((needsMathOperators && isByteOrShort) || data.UnderlyingType is DomainPrimitiveUnderlyingType.DateOnly or DomainPrimitiveUnderlyingType.TimeOnly) - { - usings.Add("AltaSoft.DomainPrimitives"); - } - builder.AppendSourceHeader("AltaSoft DomainPrimitives Generator"); builder.AppendUsings(usings); diff --git a/src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs b/src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs index 3ca3b6f..b36377c 100644 --- a/src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs +++ b/src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs @@ -29,6 +29,7 @@ internal static void AddSwaggerOptions(string assemblyName, List usings.Add("Swashbuckle.AspNetCore.SwaggerGen"); usings.Add("Microsoft.OpenApi.Models"); usings.Add("Microsoft.OpenApi.Any"); + usings.Add("AltaSoft.DomainPrimitives"); builder.AppendUsings(usings); builder.AppendLine("[assembly: AltaSoft.DomainPrimitives.DomainPrimitiveAssemblyAttribute]");