postsharp / Metalama

Metalama is a Roslyn-based meta-programming framework. Use this repo to report bugs or ask questions.
181 stars 6 forks source link

Feature: Allow the introduction of interfaces #340

Closed WhitWaldo closed 3 weeks ago

WhitWaldo commented 4 months ago

The recent RC provides the new capability to introduce new classes to a project. I'd like to expand on this and see the introduction of new interfaces as well.

My use case is as follows: I implement a bunch of microservices. A significant number of the classes I produce for these are simply connection points between each of them to facilitate data transfer and method invocation between one another. I intend to use the ability to introduce new classes to automatically stand up proxies built atop interfaces to facilitate this for me, but ASP.NET Core controllers pose an interesting problem to this idea in that while they will indirectly return a bool or an List<Guid>, they do so via Task<Results<Ok<List<Guid>>>> which means it cannot directly implement an interface that requires a List<Guid> be returned from a method. As such, I'd like to be able to auto-generate "HttpController" interfaces from a base interface in which I automatically generate and maintain this translated equivalent.

Thank you for the consideration!

gfraiteur commented 4 months ago

Thank you for filing. We know about this gap (struct, record, delegate and enum are also missing) and this will come in a later release.

prochan2 commented 3 weeks ago

This feature has been added to Metalama 2025.0.5-preview.