AOPMethods–dogfooding
I was trying to apply AOPMethods to – surprise! – AOPMethods project itself. And I have discovered a new reason: I do not want to make the methods public. I just want to put try/catch around them to know what is wrong.
The fast – and not so good – idea was to transform
MethodPrefix =”pub”
into a
Dictionary<MethodsPrefix: string, VIsibilty: string>
in order to pass something like that
{ “pub”, “public” } , {“prv”, “private”}
The second idea was better : what if I allow multiple instances and generate accordingly ?
So I came up with this definition
[AutoMethods(template = TemplateMethod.MethodWithPartial, MethodPrefix =”pub”)]
[AutoMethods(template = TemplateMethod.CustomTemplateFile,CustomTemplateFileName =”privateTryCatch.txt”, MethodSuffix = “bup”)]
partial class Person
And the code processes both attributes – and generates the code. One slightly problem: Cannot have GeneratedCode and CompilerGenerated on both generated files. But – it works!
Leave a Reply