You want aspect-oriented programming.
There are 4 basic aromas of AOP
- Runtime
RealProxyaop - Subroutine Subclass / AOP Virtual Method
- Post Compile IL weave AOP
- Precompile AOP source code
( ). , "" . , , IL, Post Compile IL.
, ,
- Unity
- Spring.NET
- Castle.Windsor
, , , Entity Framework ( Lazy-, ).
, . , dll , , .
- Postharp Pro
- Mono.Cecil
- Fody ( mono.cecil)
. , - .. . #. ... ... .
, , Fody. , , ( Postsharp Pro), nuget Fody.MethodTimer.