Add support to generate code for interface without a namespace (#46)

This commit is contained in:
Stef Heyenrath
2022-12-13 18:51:06 +01:00
committed by GitHub
parent 3eb9d8ce5f
commit 72a40e6f6a
13 changed files with 163 additions and 14 deletions
@@ -84,6 +84,8 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
configurationForMapster = GenerateMapperConfigurationForMapster();
}
var (namespaceStart, namespaceEnd) = NamespaceBuilder.Build(pd.Namespace);
return $@"//----------------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
@@ -96,8 +98,7 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
{(SupportsNullable ? "#nullable enable" : string.Empty)}
using System;
namespace {pd.Namespace}
{{
{namespaceStart}
public {@abstract}partial class {className} : {extends}{interfaceName}
{{
public {@new}{targetClassSymbol.Symbol} _Instance {{ get; }}
@@ -117,7 +118,7 @@ namespace {pd.Namespace}
{configurationForMapster}
}}
}}
}}
{namespaceEnd}
{(SupportsNullable ? "#nullable disable" : string.Empty)}";
}