InterfaceGenerator
InterfaceGenerator copied to clipboard
feat: ability to inherit from GenerateAutoInterfaceAttribute.
Added ability to inherit Attribute from GenerateAutoInterfaceAttribute.
Added GenerateGenericAutoInterfaceAttribute which will generate an auto interface with implementer type as a generic parameter, example:
[GenerateGenericAutoInterfaceAttribute] public class A : IA { public int N { get; } }
// will generate:
public interface IA : IAutoInterface<A> { int N { get; } }
Generated public auto interfaces are inherited from IAutoInterface and IAutoInterface<T> to allow constraint type restrictions. Attributes moved from generated code to separate project (included in the same nuget package), to allow inherited from GenerateAutoInterfaceAttribute classes to be used in linked projects.
Generated files are marked with // <auto-generated/> to turn off warnings.
Enabled #nullable for generated files.
Added support for nested types, example:
class A { public int N { get; } }
[GeneratedAutoInterface] class B : A { }
// will generate:
interface IB { int N { get; } }