Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to inherit from GenerateAutoInterfaceAttribute. #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

avtc
Copy link

@avtc avtc commented May 16, 2024

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; } }

avtc added 4 commits May 16, 2024 13:35
Generated public auto interfaces are inherited from IAutoInterface and IAutoInterface<T> to allow constraint type restrictions.
Attributes moved from generated code to separate project (and nuget package), to allow inherited from GenerateAutoInterfaceAttribute classes to be used in linked projects. That package must be installed independently.
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 A { get; } }
  [GeneratedAutoInterface] class B : A { }
will generate:
  interface IB { int A { get; } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant