Skip to content

Proxy generation #52

@GrahamTheCoder

Description

@GrahamTheCoder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions