From 5bc6c9ae7d5ed093638d88cb5e92efeb5410eaf2 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 16 Apr 2025 13:09:56 +0200 Subject: [PATCH] Fix nullable warnings --- Squealify.csproj | 2 +- Table/BasicQueryMethodGenerator.cs | 2 +- TableContextGenerator.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Squealify.csproj b/Squealify.csproj index 5684891..04fb5b1 100644 --- a/Squealify.csproj +++ b/Squealify.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 0.8.0 + 0.8.1 latest true Alexandru Macocian diff --git a/Table/BasicQueryMethodGenerator.cs b/Table/BasicQueryMethodGenerator.cs index 8e08458..d1ae490 100644 --- a/Table/BasicQueryMethodGenerator.cs +++ b/Table/BasicQueryMethodGenerator.cs @@ -188,7 +188,7 @@ command.CommandText = @""{placeHolder}""; .AppendLine() .AppendLine("};"); - var methodBuilder = SyntaxBuilder.CreateMethod($"{Constants.ValueTaskType}<{context.DboType}>", Constants.FindMethodName) + var methodBuilder = SyntaxBuilder.CreateMethod($"{Constants.ValueTaskType}<{context.DboType}?>", Constants.FindMethodName) .WithModifiers($"{Constants.Public} {Constants.Async}") .WithParameter(context.PrimaryKey.PropertyType, Constants.PrimaryKeyArgumentName) .WithParameter(Constants.CancellationTokenType, Constants.CancellationTokenArgument) diff --git a/TableContextGenerator.cs b/TableContextGenerator.cs index a3297e5..af64714 100644 --- a/TableContextGenerator.cs +++ b/TableContextGenerator.cs @@ -148,7 +148,7 @@ public sealed class TableContextGenerator : IIncrementalGenerator // Replace placeholders with formatted command text var syntax = builder.Build(); - var source = syntax.ToFullString() + var source = $"#nullable enable\n{syntax.ToFullString()}\n#nullable disable" .Replace(createMethod.Placeholder, createMethod.CommandText) .Replace(createIfNotExistsMethod.Placeholder, createIfNotExistsMethod.CommandText) .Replace(insertMethod.Placeholder, insertMethod.CommandText)