This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am thinking of making a cache of entities, can i access the data of this entities from multiple threads simultaneously? I can do UnitOfWork.Detach(entity) after retriving entities from DB to prevent multithreaded access to UnitOfWork, but what about the inner state of the entity? Maybe should I avoid using some specific methods to concider the state is virtually unchangeable? |
|
|
Entities are not thread safe but in practice all field property accessors just return the field value. Where you can run into concurrency issues is in lazy loaded associations or fields - this isnt so much of a concern if the entities are detached. So you can certainly access the data from multiple threads concurrency but if you are updating you will want to introduce some form of locking to serialize access. If its only read only you will be fine.
|
|