Capgemini / Cauldron

C# Toolkit
MIT License
76 stars 18 forks source link

Constructor interception feature #45

Closed mfkl closed 6 years ago

mfkl commented 6 years ago

Following up on #44 regarding constructor interception.

Should I add it before or after base class call…

For my personal use case, I'd need to be able to run code before anything (including the base class call).

Should it be around the original constructor body

What's the other option? Inside the actual constructor body? Don't think that changes anything for me either way but other people might prefer the injected code to be run outside of the body?

Does it make sense to have a try-catch

It does not affect my particular use case, but I'd say yes. To remain consistent with the interception API for methods and properties, for one. And because user code can always throw and they might want to handle it.

reflection-emit commented 6 years ago

https://github.com/Capgemini/Cauldron/wiki/Contructor-interception Coming in the next version

mfkl commented 6 years ago

Awesome! Good job.

Cherry on cake would be to able to do conditional base calls (https://code.videolan.org/videolan/libvlcpp/blob/master/vlcpp/MediaDiscoverer.hpp#L92), but that seems hard to do since Attributes can't take Actions as constructors...

reflection-emit commented 6 years ago

Hmmm... That should be possible somehow... Let me think about that.