You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
|
Sep
(5) |
Oct
(59) |
Nov
(22) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(11) |
Feb
(3) |
Mar
(9) |
Apr
(6) |
May
(5) |
Jun
(4) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Deyan P. <de...@ho...> - 2004-11-12 17:53:10
|
Hi hammett, Sorry for the late response, but I was so busy that couldn't find time to look at the interesting stuff you've implemented :( About the mixins - I looked at the new mixin testcases you've included and I am afraid I don't understand how they can solve my problem .. If I create a MaterializeMixin with Materialize(int id) method, then I mix that one with the Country class, and in the interceptor call ((IMaterializable)invocation.Proxy).Materialize(_id); then how does this Materialize method fill the properties of the Country class (I am not good with aspect terminology, but I assume that "mixin" means that the methods of the classes are merged together, right?)? I can't write in the MaterializeMixin something like: ((Country)this)._population = 1234455; //for example, if we have private int _population; in the Country class because it doesn't compile.. Please correct me if I am wrong, but in fact the proxy (by definition) shouldn't populate itself, it should just materialize a inner (Country) object, and then delegate all method invocations to the inner object, without using reflection of course ... A simple delegation costs nothing that's why the DynamicProxyAvalonTest should deliver comparable results if the counter of the inner loop is increased ... Br, Deyan ----- Original Message ----- From: "hammett" <ha...@uo...> To: <asp...@li...> Sent: Friday, October 29, 2004 10:59 PM Subject: Re: [Aspectsharp-users] IInvocation.Proxy and IInvocation.InvocationTarget > I was just watching Simpsons (third season) and thinking about this problem > when I realised that we both were using the wrong approach :-) > > How a mixin would solve this problem: > > 1. Create a proxy for Contry, for example, and mix a Materialize mixin > 2. In your Interceptor, if not loaded, you can cast the proxy to the mixin > interface and execute the Materialize > 3. The Materialize will populate the proxy fields. No second country > object... > 4. Done! > > What you think about it, Deyan? > > The problem: only Aspect# today is capable of dealing with mixins, and we > need to refactor it to use the new dynamic proxy interfaces and strategies. > On the other hand I think nothing stop us of provide mixin capabilities > directly in DynamicProxy, and we can make the Aspect# code simpler. I think > I can do it in about one hour, more or less... > > Henry, do you have anything against that? After all, you are the author of > the original mixin code... > > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > |
From: hammett <ha...@uo...> - 2004-11-12 14:36:36
|
Fair enough. I'd use the Trace for now. Thanks, -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett ----- Original Message ----- From: "Rodrigo B. de Oliveira" <rod...@gm...> To: "hammett" <ha...@uo...> Cc: "Mike Doerfler" <mik...@gm...>; "Jerry Shea" <jer...@re...>; <asp...@li...> Sent: Friday, November 12, 2004 6:26 AM Subject: Re: [Aspectsharp-users] Re: Aspectsharp-users digest, Vol 1 #32 - 5 msgs > Default processing could be a simple Trace.WriteLine. That way just by > changing your .config file you would have meaningful output. > > I'd define an interface (or a set of events) for custom processing. > > No dependencies. > > cheers! > Rodrigo > |
From: Rodrigo B. de O. <rod...@gm...> - 2004-11-12 14:27:07
|
Default processing could be a simple Trace.WriteLine. That way just by changing your .config file you would have meaningful output. I'd define an interface (or a set of events) for custom processing. No dependencies. cheers! Rodrigo On Fri, 12 Nov 2004 12:03:36 -0800, hammett <ha...@uo...> wrote: > Hiya again! > > > Hammett, log4net is my preferred choice for warning messages. That way > > the user could configure where the warning goes. > > I understand. But one of my goals is to keep dependencies to a minimal > level. > NHibernate dependency of log4net makes sense, but DynamicProxy is just a > bunch of classes and its purpose is so limited that it wont make sense > (IMHO) > > Cheers! > |
From: hammett <ha...@uo...> - 2004-11-12 14:04:04
|
Hiya again! > Hammett, log4net is my preferred choice for warning messages. That way > the user could configure where the warning goes. I understand. But one of my goals is to keep dependencies to a minimal level. NHibernate dependency of log4net makes sense, but DynamicProxy is just a bunch of classes and its purpose is so limited that it wont make sense (IMHO) Cheers! |
From: hammett <ha...@uo...> - 2004-11-12 12:38:52
|
Hiya! ----- Original Message ----- From: "Jerry Shea" <jer...@re...> > I was trying to upgrade nhibernate's proxies to the latest version of > DynamicProxy too and was having exactly the same problem - glad to hear it > wasn't just me! Hope its not a problem anymore ;-) > On the subject of proxies, would it be a reasonable feature request to be > able to configure DynamicProxy to warn if it is trying to generate a proxy > for a class which does not have all of its public methods virtual? But it is possible and valid to override: - virtual public - virtual protected (family) - virtual protected internal What its not valid: - private - virtual internal (btw Darrick told me about this bug) About generating warnings.. Well, I'm a bit skeptical about this methods (we've talked about it before). What a warning is going to be? - Console output? - A event? - A simple callback/delegate? In any case, the user must pay attention/listen to these warnings. I'm convinced that warning the user about non-virtual methods can be a good thing (there are a lot of people requesting something similar) I'm just not sure how to handle it... :-( Ideas? -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: Mike D. <mik...@gm...> - 2004-11-11 22:24:23
|
Thanks for the quick replies Hammett! Mike On Thu, 11 Nov 2004 19:08:09 -0800, hammett <ha...@uo...> wrote: > Then yes, we are on the same page :-) > > Your AvalonProxyDeserializer is a simplified version of ours: > http://svn.digitalcraftsmen.com.br/svn/castle/trunk/Tools/DynamicProxy/DynamicProxy/Serialization/ProxyObjectReference.cs > > The only difference I've notice (although I havent checked it carefully) is > that you provide a hook allowing subclasses to add entries to > SerializationInfo. This is not possible in DynProxy as it is. However, if > the class being proxy exposes a virtual GetObjectData, it will be > (correctly) invoked. My suggestion is: move all information necessary to the > implementation of IInterceptor (that's what we have done to Aspect#, so when > a class with aspect is deserialized, the interceptor has all information > about the pointcuts and advices it needs) > > http://cvs.sourceforge.net/viewcvs.py/aspectsharp/AspectSharp2/src/AspectSharp/Core/Dispatcher/DefaultInvocationDispatcher.cs?rev=1.4&view=auto > > -- > > > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > ----- Original Message ----- > From: "Mike Doerfler" <mik...@gm...> > To: <asp...@li...> > Sent: Thursday, November 11, 2004 12:39 PM > Subject: Re: [Aspectsharp-users] Implementation of GetObjectData > > > This is the base class where most of the proxy work is handled. The > > method Invoke at the bottom contains the logic. > > > > http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/LazyInitializer.cs?rev=1.1.2.5&only_with_tag=alpha_avalon-proxy&view=auto > > > > > > Here's the class the proxy used to get serialized as and deserialized > > from. > > > > http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/AvalonProxyDeserializer.cs?rev=1.1.2.2&only_with_tag=alpha_avalon-proxy&view=auto > > > > Thanks for such as fast response! > > |
From: hammett <ha...@uo...> - 2004-11-11 21:08:29
|
Then yes, we are on the same page :-) Your AvalonProxyDeserializer is a simplified version of ours: http://svn.digitalcraftsmen.com.br/svn/castle/trunk/Tools/DynamicProxy/DynamicProxy/Serialization/ProxyObjectReference.cs The only difference I've notice (although I havent checked it carefully) is that you provide a hook allowing subclasses to add entries to SerializationInfo. This is not possible in DynProxy as it is. However, if the class being proxy exposes a virtual GetObjectData, it will be (correctly) invoked. My suggestion is: move all information necessary to the implementation of IInterceptor (that's what we have done to Aspect#, so when a class with aspect is deserialized, the interceptor has all information about the pointcuts and advices it needs) http://cvs.sourceforge.net/viewcvs.py/aspectsharp/AspectSharp2/src/AspectSharp/Core/Dispatcher/DefaultInvocationDispatcher.cs?rev=1.4&view=auto -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett ----- Original Message ----- From: "Mike Doerfler" <mik...@gm...> To: <asp...@li...> Sent: Thursday, November 11, 2004 12:39 PM Subject: Re: [Aspectsharp-users] Implementation of GetObjectData > This is the base class where most of the proxy work is handled. The > method Invoke at the bottom contains the logic. > > http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/LazyInitializer.cs?rev=1.1.2.5&only_with_tag=alpha_avalon-proxy&view=auto > > > Here's the class the proxy used to get serialized as and deserialized > from. > > http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/AvalonProxyDeserializer.cs?rev=1.1.2.2&only_with_tag=alpha_avalon-proxy&view=auto > > Thanks for such as fast response! |
From: Mike D. <mik...@gm...> - 2004-11-11 20:39:24
|
This is the base class where most of the proxy work is handled. The method Invoke at the bottom contains the logic. http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/LazyInitializer.cs?rev=1.1.2.5&only_with_tag=alpha_avalon-proxy&view=auto Here's the class the proxy used to get serialized as and deserialized from. http://cvs.sourceforge.net/viewcvs.py/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/AvalonProxyDeserializer.cs?rev=1.1.2.2&only_with_tag=alpha_avalon-proxy&view=auto Thanks for such as fast response! Mike On Thu, 11 Nov 2004 18:34:41 -0800, hammett <ha...@uo...> wrote: > Hey Mike, > > > In the new version it looks like GetObjectData is > > completely handled by the DynamicProxy and never handled by > > IInvocation - is that true or am I doing something wrong? > > Yes, you're right. > > > My old logic was to serialize the class instance that was being > > proxied if it has been read from the db, or if the class had not been > > instantiated yet then serialize a class that was capable of recreating > > the proxy during deserialization. I'm open for any suggestions on how > > to handle this with the new code base. > > Well, this is what the GetObjectData implementation in the proxy does... > But, to be sure that we are on the same page, can you please direct me to > the source code of the old logic? > > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > |
From: hammett <ha...@uo...> - 2004-11-11 20:35:07
|
Hey Mike, > In the new version it looks like GetObjectData is > completely handled by the DynamicProxy and never handled by > IInvocation - is that true or am I doing something wrong? Yes, you're right. > My old logic was to serialize the class instance that was being > proxied if it has been read from the db, or if the class had not been > instantiated yet then serialize a class that was capable of recreating > the proxy during deserialization. I'm open for any suggestions on how > to handle this with the new code base. Well, this is what the GetObjectData implementation in the proxy does... But, to be sure that we are on the same page, can you please direct me to the source code of the old logic? -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: Mike D. <mik...@gm...> - 2004-11-11 20:05:02
|
Hi Hammett! I'm working on getting the code for NHibernate to use the latest DynamicProxy code and am running into some problems :) One of the problems I'm having is around serialization of the proxies. In your old version the method GetObjectData() was passed to the IInvocationHandler. In the new version it looks like GetObjectData is completely handled by the DynamicProxy and never handled by IInvocation - is that true or am I doing something wrong? My old logic was to serialize the class instance that was being proxied if it has been read from the db, or if the class had not been instantiated yet then serialize a class that was capable of recreating the proxy during deserialization. I'm open for any suggestions on how to handle this with the new code base. Thanks! Mike |
From: hammett <ha...@uo...> - 2004-11-07 21:32:52
|
> Yeah, you're right. This's broken since my major refactoring, I havent > noticed... The get_Item is being intercepted correctly by the proxy, but > no matching is found (for some reason). > I'll dig for the reason later today. Fixed. That was a DynamicProxy properties generation problem. I was ignoring the arguments. So ashamed! :-( I'll wait for the Darrick patch and release the beta 2 as soon as possible. Cheers! |
From: hammett <ha...@uo...> - 2004-11-07 20:01:39
|
Whoops. Send to me hammett at gmail dot com Thanks, -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett ----- Original Message ----- From: Darrick Wiebe To: asp...@li... Sent: Saturday, November 06, 2004 8:17 PM Subject: [Aspectsharp-users] Postscript I forgot to mention that if the developers would like copies of the files that I have updated, I can send them if you give me an address to send them to. Darrick |
From: hammett <ha...@uo...> - 2004-11-07 16:44:34
|
Hy Darrick, Thanks for the feedback. The Castle.DynamicProxy source can be checked out from SVN repository at https://207.234.145.146/svn/castle/trunk/Tools/DynamicProxy/ > I have spent some time playing with Aspect# over the last couple of days, > and > have a few things to report to HQ. I think what you have so far is great > stuff, > and I'm really looking forward to using this in a project some time soon! Nice! :-) > First, I should note that I am using the CLR 2.0 beta1 / VS 2005. That > said, > the Aspect# 1.x version seemed to work fine, and this version almost > works, > but sometimes methods that have valid pointcuts do not get overridden by Well, I think thats the first time it has been tested against CLR 2.0. I don't even want to install the CLR 2.0 as it will make the NCover stop working.. :-( > inside AspectSharp.Core.CustomProxyGenerator. CreateClassProxy(Type, > object[], IInterceptor). For instance, in the example program that you > provide, > the MixinAndInterceptorExecution function works correctly, but the > HashTableTest > runs but get_Item is not intercepted, and using reflection I can see that > the > DeclaringType of get_Item is still HashTable. I spent a lot of time on > this but > I could not find an error in your code, and I couldn't find the source for > Castle. > DynamicProxy (the one I found at Apache.Avalon was quite different). Yeah, you're right. This's broken since my major refactoring, I havent noticed... The get_Item is being intercepted correctly by the proxy, but no matching is found (for some reason). I'll dig for the reason later today. > Secondly, I found that the cache in AspectSharp.Core.Proxy. > DefaultProxyFactory > did not work if the aspect was operating on more than one type. I think > the problem > only surfaced the second time that the second class was wrapped. Making > the > following change and adding an apropriate AspectInstanceKey class as below > fixed this: Applied! Thanks > Fourth, I have extended the method interceptor pointcut definition so that > we can specify > the accessibility of the method we want to intercept. The original syntax > still works, but > now we can also have: > > pointcut method(public * *) > pointcut method(* void *(*)) > pointcut method(internal * Method.*()) Nice! > Finally, just for fun I added this function to the AspectEngine. I think > it has potential > although it is nothing particularly spectacular right now, so I thought > I'd pass it along. > public virtual TypeToWrap WrapClass<TypeToWrap>() > { > return (TypeToWrap)WrapClass(typeof(TypeToWrap)); > } > called: > ISomeClass d = engine.WrapClass<SomeClass>(); This is nice, but depends on the CLR 2.0. In a near future we can provide two distributions. I'm looking forward for your patch! -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: Darrick W. <da...@in...> - 2004-11-07 04:19:24
|
I forgot to mention that if the developers would like copies of the = files that I have updated, I can send them if you give me an address to = send them to. Darrick |
From: Darrick W. <da...@in...> - 2004-11-07 04:18:16
|
Hi guys, I have spent some time playing with Aspect# over the last couple of = days, and have a few things to report to HQ. I think what you have so = far is great stuff, and I'm really looking forward to using this in a = project some time soon! First, I should note that I am using the CLR 2.0 beta1 / VS 2005. That = said, the Aspect# 1.x version seemed to work fine, and this version = almost works, but sometimes methods that have valid pointcuts do not get = overridden by =20 Castle.DynamicProxy.ProxyGenerator. CreateCustomClassProxy(baseClass, = interceptor, context);=20 inside AspectSharp.Core.CustomProxyGenerator. CreateClassProxy(Type, = object[], IInterceptor). For instance, in the example program that you = provide, the MixinAndInterceptorExecution function works correctly, but = the HashTableTest runs but get_Item is not intercepted, and using = reflection I can see that the DeclaringType of get_Item is still = HashTable. I spent a lot of time on this but I could not find an error = in your code, and I couldn't find the source for Castle.DynamicProxy = (the one I found at Apache.Avalon was quite different). Secondly, I found that the cache in AspectSharp.Core.Proxy. = DefaultProxyFactory did not work if the aspect was operating on more = than one type. I think the problem only surfaced the second time that = the second class was wrapped. Making the following change and adding an = apropriate AspectInstanceKey class as below fixed this: private Type GetProxyTypeFromCache (AspectDefinition aspect, Type = baseClass) { return _aspect2ProxyType[new AspectInstanceKey(aspect, baseClass)] = as Type; } private void RegisterProxyTypeInCache (AspectDefinition aspect, Type = baseClass, Type proxyType) { _aspect2ProxyType[new AspectInstanceKey(aspect, baseClass)] =3D = proxyType; } Third, I discovered that the parser does not treat '_' as an ID token. = I have fixed this as well. Fourth, I have extended the method interceptor pointcut definition so = that we can specify the accessibility of the method we want to = intercept. The original syntax still works, but now we can also have: pointcut method(public * *) pointcut method(* void *(*)) pointcut method(internal * Method.*()) etc. Finally, just for fun I added this function to the AspectEngine. I = think it has potential although it is nothing particularly spectacular = right now, so I thought I'd pass it along. public virtual TypeToWrap WrapClass<TypeToWrap>() { return (TypeToWrap)WrapClass(typeof(TypeToWrap)); } called: ISomeClass d =3D engine.WrapClass<SomeClass>(); Cheers! Darrick Wiebe |
From: <hen...@gm...> - 2004-11-04 17:05:02
|
Inlines. On Thu, 4 Nov 2004 13:35:59 -0800, hammett <ha...@uo...> wrote: > Hiya! > What do you think about agreeing on a Roadmap? >=20 > I raise the following points: >=20 > - To support or not support attributes? > If so, do you have an example of how it would be/work? Reviewing my standpoint, I don't think that is necessary more configuration approaches. Either XML or Attributes are much complex and less descritive ways comparing with the bult-in language(we could name it...) >=20 > - Drop AopAlliance compatibility +1=20 > Why? The AopAlliance interfaces are rubbish. It was just a blind > port of the Java version. Also the AopAlliance.IInvocation doesn't help= us > to optimize the invocations. We can't cache the IInvocation cause it > stores > the arguments (if we do, in a multithread situation we'll have problems= ) > or we can > develop a thread affinity cache, which is complex and we not meant to b= e > that complex. >=20 > - Any more directions to grow? A tool for static weaving?=20 Some debug facilities like debbugable proxies or interceptor chain trace? >=20 > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users >=20 --=20 Cheers, Henry Concei=E7=E3o |
From: hammett <ha...@uo...> - 2004-11-04 15:36:43
|
Hiya! What do you think about agreeing on a Roadmap? I raise the following points: - To support or not support attributes? If so, do you have an example of how it would be/work? - Drop AopAlliance compatibility Why? The AopAlliance interfaces are rubbish. It was just a blind port of the Java version. Also the AopAlliance.IInvocation doesn't help us to optimize the invocations. We can't cache the IInvocation cause it stores the arguments (if we do, in a multithread situation we'll have problems) or we can develop a thread affinity cache, which is complex and we not meant to be that complex. - Any more directions to grow? -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: hammett <ha...@uo...> - 2004-11-04 05:07:22
|
Change log: - Method Wrap is now marked as obsolete - Methods WrapClass and WrapInterface introduced. - Dropped IEngineAware interface - Serialization issues fixed - Refactoring and simplifications to use the new features of DynamicProxy -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: hammett <ha...@uo...> - 2004-11-01 19:16:31
|
Hello, I got rid of all that creepy IL Emit Code in the proxy generator classes by developing a simple object model able to generate types, methods, properties, constructors, nested types and callables. It was very drive to DynamicProxy necessity, "do the simplest thing that could possible work". So the hundred lines code for WriteILMethod turned into the simplest form: protected virtual void WriteInterceptorInvocationMethod(MethodInfo method, EasyMethod builder) { ArgumentReference[] arguments = builder.Arguments; LocalReference local_inv = builder.CodeBuilder.DeclareLocal(typeof (IInvocation)); EasyCallable callable = m_method2Delegate[method] as EasyCallable; FieldReference fieldDelegate = ObtainCallableFieldBuilderDelegate( callable ); builder.CodeBuilder.AddStatement( new AssignStatement( local_inv, new VirtualMethodInvocationExpression(m_method2Invocation, fieldDelegate.ToExpression(), new MethodTokenExpression(method)) ) ); LocalReference ret_local = builder.CodeBuilder.DeclareLocal( typeof(object) ); builder.CodeBuilder.AddStatement( new AssignStatement( ret_local, new VirtualMethodInvocationExpression( InterceptorField, typeof (IInterceptor).GetMethod("Intercept"), local_inv.ToExpression(), new ReferencesToObjectArrayExpression(arguments)))); if (builder.ReturnType == typeof (void)) { builder.CodeBuilder.AddStatement( new ReturnStatement() ); } else { builder.CodeBuilder.AddStatement( new ReturnStatement( new ConvertExpression(builder.ReturnType, ret_local.ToExpression())) ); } } Oh, and btw all the serialization issues were fixed too. That was a long weekend. Phew! CodeBuilder http://www.digitalcraftsmen.com.br/svn/castle/trunk/Tools/DynamicProxy/DynamicProxy/Builder/CodeBuilder/ SimpleAST http://www.digitalcraftsmen.com.br/svn/castle/trunk/Tools/DynamicProxy/DynamicProxy/Builder/CodeBuilder/SimpleAST/ -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: hammett <ha...@uo...> - 2004-10-30 04:51:35
|
Simple usage: GeneratorContext context = new GeneratorContext(); SimpleMixin mixin1 = new SimpleMixin(); OtherMixin mixin2 = new OtherMixin(); context.AddMixinInstance( mixin1 ); context.AddMixinInstance( mixin2 ); AssertInvocationInterceptor interceptor = new AssertInvocationInterceptor(); object proxy = m_generator.CreateCustomClassProxy( typeof(SimpleClass), interceptor, context ); ISimpleMixin mixin = proxy as ISimpleMixin; IOtherMixin other = proxy as IOtherMixin; Now the painfull refactor in Aspect# will be painless :-) -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: hammett <ha...@uo...> - 2004-10-29 18:00:37
|
I was just watching Simpsons (third season) and thinking about this problem when I realised that we both were using the wrong approach :-) How a mixin would solve this problem: 1. Create a proxy for Contry, for example, and mix a Materialize mixin 2. In your Interceptor, if not loaded, you can cast the proxy to the mixin interface and execute the Materialize 3. The Materialize will populate the proxy fields. No second country object... 4. Done! What you think about it, Deyan? The problem: only Aspect# today is capable of dealing with mixins, and we need to refactor it to use the new dynamic proxy interfaces and strategies. On the other hand I think nothing stop us of provide mixin capabilities directly in DynamicProxy, and we can make the Aspect# code simpler. I think I can do it in about one hour, more or less... Henry, do you have anything against that? After all, you are the author of the original mixin code... -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett |
From: <hen...@gm...> - 2004-10-29 17:07:07
|
Sure! I'll make some tests today... On Thu, 28 Oct 2004 22:30:16 -0200, Rodrigo B. de Oliveira <rod...@gm...> wrote: > Something along the following lines if I recall our conversation correctl= y: >=20 > <snip> >=20 > import System > import System.IO > import System.Runtime.Serialization > import System.Runtime.Serialization.Formatters.Binary >=20 > class Person: >=20 > [property(FirstName)] > _fname =3D "" >=20 > [property(LastName)] > _lname =3D "" >=20 > class PersonProxy(Person, ISerializable): >=20 > transient _caboosh =3D 0 >=20 > def constructor(): > pass >=20 > def constructor(info as SerializationInfo, context as StreamingContex= t): > data =3D info.GetValue("Person.Data", typeof((object))) > FormatterServices.PopulateObjectMembers(self, > GetSerializableMembers(), data) >=20 > def GetObjectData(info as SerializationInfo, context as StreamingCont= ext): > members =3D GetSerializableMembers() > info.AddValue("Person.Data", > FormatterServices.GetObjectData(self, members)) >=20 > def GetSerializableMembers(): > return FormatterServices.GetSerializableMembers(Person) >=20 > def serialize(o): > stream =3D MemoryStream() > BinaryFormatter().Serialize(stream, o) > return stream.GetBuffer() >=20 > def deserialize(buffer as (byte)): > return BinaryFormatter().Deserialize(MemoryStream(buffer)) >=20 > p =3D PersonProxy(FirstName: "John", LastName: "Cleese") > p =3D deserialize(serialize(p)) >=20 > assert "John" =3D=3D p.FirstName > assert "Cleese" =3D=3D p.LastName > </snip> >=20 > cheers, > Rodrigo >=20 >=20 >=20 > On Thu, 28 Oct 2004 21:06:20 -0700, hammett <ha...@uo...> wrote: > > Hiya, > > > > I was talking to bamboo today and thinking about this problem. One poss= ible > > solution suggested by him relies on the use of FormatterServices. > > > > Henry, can you please check this out? > > > > -- > > Cheers, > > hammett > > http://www.digitalcraftsmen.com.br/~hammett > > > > ------------------------------------------------------- > > This Newsletter Sponsored by: Macrovision > > For reliable Linux application installations, use the industry's leadin= g > > setup authoring tool, InstallShield X. Learn more and evaluate > > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > > _______________________________________________ > > Aspectsharp-users mailing list > > Asp...@li... > > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > > >=20 >=20 > -- > bamboo > http://blogs.codehaus.org/people/bamboo/ >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This Newsletter Sponsored by: Macrovision > For reliable Linux application installations, use the industry's leading > setup authoring tool, InstallShield X. Learn more and evaluate > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users >=20 --=20 Cheers, Henry Concei=E7=E3o |
From: hammett <ha...@uo...> - 2004-10-29 15:41:33
|
Hello Deyan, I've spent an hour in optimization, but I think you wont benefit from it. The last optimization is to avoid instantiate the delegates, so, for each delegate generated we create a instance field and initialize if in the constructor. It made a hell of difference in my performance test Execution took 156 // interface proxy using reflection Execution took 110 Execution took 125 Execution took 125 Execution took 62 // class proxy Execution took 47 Execution took 47 Execution took 47 Deyan, I think one thing you can try before we step a little further is to compile everything to Release. In debug mode the DynamicProxy writes the assembly to the disk and no code optimization is applied by C# compiler too. I've noticed some time differences amongst Debug and Release compilation. If you still experiencing poor results, we'll go a step further creating delegates to an inner type. This will be a hack, thus I'd like to avoid it. but I also would like to see good results, so I'm willing to implement it if it's really necessary. -- Cheers, hammett http://www.digitalcraftsmen.com.br/~hammett ----- Original Message ----- From: "Deyan Petrov" <de...@ho...> To: <asp...@li...> Sent: Thursday, October 28, 2004 11:47 PM Subject: Re: [Aspectsharp-users] IInvocation.Proxy and IInvocation.InvocationTarget > Hi hammett, > > Ok, sorry, the correct link to the new source is: > > http://www20.brinkster.com/deyanp/dynproxy/DynamicProxyAvalonTest2.zip > > > Br, > Deyan > > > ----- Original Message ----- > From: "hammett" <ha...@uo...> > To: <asp...@li...> > Sent: Thursday, October 28, 2004 11:54 PM > Subject: Re: [Aspectsharp-users] IInvocation.Proxy and > IInvocation.InvocationTarget > > >> Hello Deyan, >> >> I'd like to see the code, but I'm having problems downloading the zip >> file >> now.. >> I'll check it again tonight. By now, I imagine some tweaks that we can > try. >> >> -- >> Cheers, >> hammett >> http://www.digitalcraftsmen.com.br/~hammett >> >> >> ----- Original Message ----- >> From: "Deyan Petrov" <de...@ho...> >> To: <asp...@li...> >> Sent: Thursday, October 28, 2004 8:48 AM >> Subject: Re: [Aspectsharp-users] IInvocation.Proxy and >> IInvocation.InvocationTarget >> >> >> >> >> >> ------------------------------------------------------- >> This Newsletter Sponsored by: Macrovision >> For reliable Linux application installations, use the industry's leading >> setup authoring tool, InstallShield X. Learn more and evaluate >> today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ >> _______________________________________________ >> Aspectsharp-users mailing list >> Asp...@li... >> https://lists.sourceforge.net/lists/listinfo/aspectsharp-users >> > > > ------------------------------------------------------- > This Newsletter Sponsored by: Macrovision > For reliable Linux application installations, use the industry's leading > setup authoring tool, InstallShield X. Learn more and evaluate > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > |
From: Deyan P. <de...@ho...> - 2004-10-29 06:47:11
|
Hi hammett, Ok, sorry, the correct link to the new source is: http://www20.brinkster.com/deyanp/dynproxy/DynamicProxyAvalonTest2.zip Br, Deyan ----- Original Message ----- From: "hammett" <ha...@uo...> To: <asp...@li...> Sent: Thursday, October 28, 2004 11:54 PM Subject: Re: [Aspectsharp-users] IInvocation.Proxy and IInvocation.InvocationTarget > Hello Deyan, > > I'd like to see the code, but I'm having problems downloading the zip file > now.. > I'll check it again tonight. By now, I imagine some tweaks that we can try. > > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > > ----- Original Message ----- > From: "Deyan Petrov" <de...@ho...> > To: <asp...@li...> > Sent: Thursday, October 28, 2004 8:48 AM > Subject: Re: [Aspectsharp-users] IInvocation.Proxy and > IInvocation.InvocationTarget > > > > > > ------------------------------------------------------- > This Newsletter Sponsored by: Macrovision > For reliable Linux application installations, use the industry's leading > setup authoring tool, InstallShield X. Learn more and evaluate > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > |
From: Rodrigo B. de O. <rod...@gm...> - 2004-10-29 00:30:26
|
Something along the following lines if I recall our conversation correctly: <snip> import System import System.IO import System.Runtime.Serialization import System.Runtime.Serialization.Formatters.Binary class Person: [property(FirstName)] _fname = "" [property(LastName)] _lname = "" class PersonProxy(Person, ISerializable): transient _caboosh = 0 def constructor(): pass def constructor(info as SerializationInfo, context as StreamingContext): data = info.GetValue("Person.Data", typeof((object))) FormatterServices.PopulateObjectMembers(self, GetSerializableMembers(), data) def GetObjectData(info as SerializationInfo, context as StreamingContext): members = GetSerializableMembers() info.AddValue("Person.Data", FormatterServices.GetObjectData(self, members)) def GetSerializableMembers(): return FormatterServices.GetSerializableMembers(Person) def serialize(o): stream = MemoryStream() BinaryFormatter().Serialize(stream, o) return stream.GetBuffer() def deserialize(buffer as (byte)): return BinaryFormatter().Deserialize(MemoryStream(buffer)) p = PersonProxy(FirstName: "John", LastName: "Cleese") p = deserialize(serialize(p)) assert "John" == p.FirstName assert "Cleese" == p.LastName </snip> cheers, Rodrigo On Thu, 28 Oct 2004 21:06:20 -0700, hammett <ha...@uo...> wrote: > Hiya, > > I was talking to bamboo today and thinking about this problem. One possible > solution suggested by him relies on the use of FormatterServices. > > Henry, can you please check this out? > > -- > Cheers, > hammett > http://www.digitalcraftsmen.com.br/~hammett > > ------------------------------------------------------- > This Newsletter Sponsored by: Macrovision > For reliable Linux application installations, use the industry's leading > setup authoring tool, InstallShield X. Learn more and evaluate > today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/ > _______________________________________________ > Aspectsharp-users mailing list > Asp...@li... > https://lists.sourceforge.net/lists/listinfo/aspectsharp-users > -- bamboo http://blogs.codehaus.org/people/bamboo/ |