Mar 12, 2011 at 7:28 PM
Edited Mar 12, 2011 at 7:30 PM
Rainbird, it's still just a sketch (although it actually works as expected). I need your help to design some decent API over it.
For now, there are two problems:
- It's impossible to have more than one query handler per component host (they all share IQueryRemoteHandler interface).
- Queryable proxy is always IQueryHandler with two methods: Get(Type t) and Get<T>(). There's no easy way to add more features of my remote component to this proxy.
The first problem could be solved if Zyan could host several components with the same interface, something like this:
host.RegisterComponent<IQueryRemoteHandler>(ServiceNames.PocoServerName, () => new ZyanServerQueryHandler(/* ObjectSource setup */));
host.RegisterComponent<IQueryRemoteHandler>(ServiceNames.DataContextName, () => new ZyanServerQueryHandler(/* Linq2Sql DataContext setup... */));
var pocoProxy = connection.CreateQueryableProxy(ServiceNames.PocoServerName);
var dataContextProxy = connection.CreateQueryableProxy(ServiceNames.DataContextName);
String names are attached to different components sharing same interface. I don't really like string names, but I just don't see how it could be done in compiler-friendly manner.
The second problem arises from .NET Remoting restrictions (proxies with generic methods are not allowed). So we have two different interfaces here: one for the server (IQueryRemoteHandler) and one for the client (IQueryHandler with generic method Get). If
I need to extend my queryable proxy, I would probably have to subclass IQueryHandler, IQueryRemoteHandler and ZyanServerQueryHandler, which looks like way too much for such a small task.
Any ideas? :)