Hi,
i'm working on a application using Windows Forms. The app builds upon
Castle and NHibernate. Because
i don't want to have any references to NHibernate in the domain model
or the view, i use a separate layer to
access persistent objects. This is done through castle, with the
following sample configuration:
<configuration>
<components>
<component
id="IPersistenceService"
service="Persistence.Broker.Definition.IPersistenceService,
Persistence.Broker"
type="Persistence.Broker.NHibernate.PersistenceService,
Persistence.Broker.NHibernate">
</component>
<component
id="IRepository"
service="Persistence.Broker.Definition.IRepository`1,
Persistence.Broker"
type="Persistence.Broker.NHibernate.NHibernateRepository`1,
Persistence.Broker.NHibernate"
lifestyle="transient">
</component>
</components>
</configuration>
So far so good. Everything works fine while running the application.
The IPersistenceService provides
access to metadata informations about the domain model. This
information is needed for certain
circumstances. One example is data binding. And here we come close to
the problem. For example I want to write an ObjectSource - class,
based on BindingSource. The ObjectSource should provide an
implementation
for the
PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[]
listAccessors)
method that returns a PropertyDescriptorCollection based on the class,
the ObjectSource is responsible for.
To achieve this, the ObjectSource needs a property that specifies the
IClassDefinition that holds the information about attributes etc. For
this reason i build an UITypeEditor that simply displays a ListBox
where the
developer can select the needed IClassDefinition. The UITypeEditor
needs access to the metadata information at design time and that
means, it needs access to an instance of IPersistenceService. And here
we are...i have to build a WindsorContainer at design time that wires
up the services correctly. But this does not work. I can build the
container and load the configuration XML, but Castle can not resolve
the type for Persistence.Broker.NHibernate.PersistenceService. So my
first thougth was, that the assemblies could not be find. This is
surely true, because the VS FormDesigner stores files in an temp
directory. So I tried to give the assemblies strong names to put them
in the GAC. But the container still complains about not resolving the
type Persistence.Broker.NHibernate.PersistenceService. The next try
was to load the necessary assemblies by myself. There was no failure
loading them at design time, but der Container still was not able to
resolve then correct type. So I ended up, building an application
object just for design time purposes, that uses an own application
domain with the base directory pointing to the assemblies. I created
the Container in the context of the new domain, but it still does not
work.
So now i have no further idea, how to solve this. I have to admit that
i'm not so deep in all the .net internals rigth now, because i just
came over from C++/Delphi. Maybe the solution is really simple, and i
just can not see it :-)
So, if you anyone could give me a hint, maybe just about how Castle
resolves assemblies at all, it would be very grateful.
Thanks for reading
Volker
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---