Castle ActiveRecord: session error search and access to lazy loading property in different threads
- by sc911
Hi *,
I've got a problem with an multi-threaded desktop application using Castle ActiveRecord in C#:
To keep the GUI alive while searching for the objects based on userinput I'm using the BackgroundWorker for the search-function. Some of the properties of the objects, especially some HasMany-Relations, are marked as Lazy.
Now, when the search is finished and the user selects an resulting object, some of the properties of this object should be displayed. But as the search was done by the BackgroundWorker in a different thread, accessing the properties fails as the session for the lazy-access is no longer available.
What will be the best way to do the search in an extra thread to keep the GUI alive and to access all properties correctly including those marked as lazy?
Thanks for any advise!
Regards
sc911