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

Proxy generation #52

Open
GrahamTheCoder opened this issue Sep 22, 2024 · 0 comments
Open

Proxy generation #52

GrahamTheCoder opened this issue Sep 22, 2024 · 0 comments

Comments

@GrahamTheCoder
Copy link

GrahamTheCoder commented Sep 22, 2024

Interesting library!

Is your feature request related to a problem? Please describe.
Ultimately, I want a decorator that can serialize to files the inputs/outputs to any method on a given class.

Describe the solution you'd like
I can imagine several useful pieces of this puzzle:

  • [Decorator(generateInterface: true)] should generate an interface too
    • [GenerateInterface] attribute to create the interface from the class probably makes sense too but not needed for this
  • The decorators generated could call an empty virual pre/post method.
    • For my use case, just passing an array of object would be fine for the args, but I can see that might make people uncomfortable in terms of allocations/performance in the general case where they are unused. Perhaps better to only call them if a partial class or subclass of the decorator exists and implements one of the methods. Or you could make this a separate attribute such as [Proxy] to more accurately reflect the purpose.

Describe alternatives you've considered
What I'll do in the meantime is autogenerate the interface with https://www.nuget.org/packages/InterfaceGenerator/. Use castle.core to proxy the runtime object, recording (serializing) inputs/outputs so that I can characterize exact current behaviour, and reuse the curremnt behaviour without needing the real object and its dependencies.

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

No branches or pull requests

1 participant