|
From: hammett <ha...@uo...> - 2004-10-22 19:35:04
|
Hello Mike,
We're currently moving our codebase from ASF, so expect a different
namespace. I antecipate my apologies! :-)
Well, the public constructor isnt a problem, really. I think the requirement
came from our lazyness.
protected ConstructorBuilder GenerateConstructor()
{
ConstructorBuilder consBuilder = m_typeBuilder.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
new Type[] {typeof (IInvocationHandler)});
ILGenerator ilGenerator = consBuilder.GetILGenerator();
ilGenerator.Emit(OpCodes.Ldarg_0);
ilGenerator.Emit(OpCodes.Call, m_baseType.GetConstructor(new Type[0]));
ilGenerator.Emit(OpCodes.Ldarg_0);
ilGenerator.Emit(OpCodes.Ldarg_1);
ilGenerator.Emit(OpCodes.Stfld, m_handlerField);
ilGenerator.Emit(OpCodes.Ret);
return consBuilder;
}
I'll change the baseType.GetConstructor to be smarter.
About the protected methods, I'd better write a test case before I answer
that, but should not be a problem....
--
Cheers,
hammett
http://www.digitalcraftsmen.com.br/~hammett
----- Original Message -----
From: "Mike Doerfler" <mik...@gm...>
To: <asp...@li...>
Sent: Friday, October 22, 2004 12:12 PM
Subject: [Aspectsharp-users] DynamicProxy
> Hi guys. Before I ask my question I just want to say good job on the
> work so far! I'm working on getting Dynamic Proxying working with
> NHibernate and so far so good.
>
> One of the things I'm running into is that for a Class to be proxyable
> the ctor has to be public and the properties/methods have to be
> virtual and public. The virtual requirement makes sense - can't
> override a non virtual method. Is there any reason that the
> constructor and properties/methods with an access level of protected
> can't be proxied? It looks like a relatively small code change in
> BaseCodeGenerator but since it looked small there has to be something
> else to it :)
>
> Thanks and keep up the good work!
>
> Mike
>
>
|