mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
Nullable
This commit is contained in:
@ -18,6 +18,7 @@ using Esiur.Core;
|
||||
namespace Esiur.Proxy;
|
||||
|
||||
[Generator]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1036:Specify analyzer banned API enforcement setting", Justification = "<Pending>")]
|
||||
public class ResourceGenerator : ISourceGenerator
|
||||
{
|
||||
|
||||
@ -182,7 +183,10 @@ public class ResourceGenerator : ISourceGenerator
|
||||
{
|
||||
|
||||
var code = @$"using Esiur.Resource;
|
||||
using Esiur.Core;
|
||||
using Esiur.Core;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace {ci.ClassSymbol.ContainingNamespace.ToDisplayString()} {{
|
||||
";
|
||||
|
||||
@ -192,8 +196,8 @@ namespace {ci.ClassSymbol.ContainingNamespace.ToDisplayString()} {{
|
||||
{
|
||||
code +=
|
||||
@$" public partial class {ci.Name} : IResource {{
|
||||
public virtual Instance Instance {{ get; set; }}
|
||||
public virtual event DestroyedEvent OnDestroy;
|
||||
public virtual Instance? Instance {{ get; set; }}
|
||||
public virtual event DestroyedEvent? OnDestroy;
|
||||
|
||||
public virtual void Destroy() {{ OnDestroy?.Invoke(this); }}
|
||||
";
|
||||
|
@ -270,6 +270,8 @@ public static class TemplateGenerator
|
||||
var rt = new StringBuilder();
|
||||
|
||||
rt.AppendLine("using System;\r\nusing Esiur.Resource;\r\nusing Esiur.Core;\r\nusing Esiur.Data;\r\nusing Esiur.Net.IIP;");
|
||||
rt.AppendLine("#nullable enable");
|
||||
|
||||
rt.AppendLine($"namespace {nameSpace} {{");
|
||||
|
||||
if (template.Annotation != null)
|
||||
|
Reference in New Issue
Block a user