Hello, all.

I am working with the Dynamic Proxy feature, and am looking for a way to 
deal with a serialization problem that I expect to crop up.

First, a little background.  I am working on code that builds dynamic 
proxies using a single base concrete class and a list of interfaces, one of 
which changes based on the specific type of object I need to emulate.  New 
types are being created for each different interface exactly as expected, 
and their names are "Castle.Proxies.ConcreteClassProxy," 
"Castle.Proxies.ConcreteClassProxy_2," etc.  These proxy objects also need 
to be serialized away and deserialized on postback.  I have all of this is 
working perfectly for me locally in IIS Express.

However, I am predicting that if I were to deploy this code into our 
6-server web farm, there will be problems.  Since the class names are being 
generated with these sequential numbers based on the order in which they 
are needed, which ultimately depends on the order in which pages are 
requested by users, the dynamic type names for interfaces X and Y could be 
different between servers depending on which one was created first.  And I 
also assume that this will cause deserialization problems if a proxy object 
is created on one server and deserialized on another because of the type 
names being different.

I was trying to figure out if there were a way to name the dynamic classes 
after both the concrete class AND the implemented interfaces.  I found a 
Stack Overflow article where someone suggested a way to control the class 
names by injecting a custom INamingScope object, but this appears to be 
called too late in the process to do what I want to do.  And there also 
appears to be no good way to inject such behavior into the 
BaseProxyGenerator, which is where the dynamic type name is created.

So I my question for everyone is two-fold.  First, am I correct that this 
will be an issue that needs to be resolved?  Second, if so, does anyone 
have a suggestion for how to most correctly address this?


You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to