Castle ActiveRecord: session error search and access to lazy loading property in different threads

Posted by sc911 on Stack Overflow See other posts from Stack Overflow or by sc911
Published on 2010-05-10T14:48:51Z Indexed on 2010/05/10 14:54 UTC
Read the original article Hit count: 298

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

© Stack Overflow or respective owner

Related posts about castle-activerecord

Related posts about c#