I'm toying with building a workflow engine to wrap up my service layer and would like to explore the approach that EF takes to generate transparent proxy classes but I can't seem to figure out from the code on GitHub / CodePlex how it actually works.
Could someone point me in the right direction / explain the process?
Does it do this at runtime or compile time?
...
Key difference:
EF is interested in properties and tracks changes on them, I am interested in wrapping method calls to an instance of any type with some logic that would call in to my workflow engine to "raise an event".
Ok so after some digging about it looks like its using T4 templates to export the types at compile time then interception to basically replace the request of the original object with the generated proxy type at runtime.
Key parts of the code ...
T4 templates are here:
The interception code is here:
In short it should be possible to reproduce similar behaviour using T4 templating in my own code then have my service factory look for the proxy type using a naming convention.
Pretty clean, kudos to M$ on this one :)