Browse by Tags
All Tags »
il emit (
RSS)
The new bits for my AOP framework. The changes for the helper class were relatively minimal. Method creation: 1: public IGenerationContext CreateMethod(TypeBuilder typeBuilder, MethodInfo method) 2: { 3: Type[] parameterTypes = GetParameterTypes(method); 4: MethodAttributes attributes = MethodAttributes.Public; 5: if (!method.IsFinal) 6: attributes |= MethodAttributes.Virtual; 7: 8: MethodBuilder methodInfoBody = typeBuilder.DefineMethod( 9: method.Name, 10: attributes, 11: method.CallingConvention...
In the previous post I talked about how to create a simple, not really helpful (yet), proxy class. In this post I'll add, for each method, the complete implementation - includes try-catch block and method calls the to intercepting library that will in turn propagate the call to all the registered advices based on the pointcusts. What do I need in order to accomplish this? Well, I saw how to call methods, I'm missing the try catch part, the pointcuts and generics. I'll leave generics for...
I managed to write some code from the last post in this series and I got a name for the project - InterceptIt and I uploaded the initial drop. I created IL emitter helper class that will be in charge of declaration of variables, constants, members, methods, constructors, properties and method and constructor invocation. Variables: Helper class overview: When creating a constructor or method the returned parameter is IGenerationContext that provides access to the ILGenerator for that context. IGenerationContext...
This is the 1st post in a series of posts regarding the issues involved with creation of AOP framework. ...