Working with threads

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
jwrz
Posts: 15
Joined: Mon 22 Aug 2016 05:30

Working with threads

Post by jwrz » Mon 09 Jul 2018 05:34

Hi, I would like to ask what are the recommendations for working with many threads (and many Contexts - these issues overlap in my opinion). Are EntityDAC mechanisms thread save?

How to work with Context - in Entity Framework, Context should be created for the smallest period of time (very fast warm start). At EntityDAC we have a special component that stores the main Context - I think that is a bad solution, for example, can lead to random saves or rejects. I'm afraid that in the case of the ISAP server side application, when IIS automatically paralleled the execution of queries, everything will fall apart.

PS I'm asking here because the documentation is silent on this topic.

MaximG
Devart Team
Posts: 1030
Joined: Mon 06 Jul 2015 11:34

Re: Working with threads

Post by MaximG » Tue 10 Jul 2018 08:15

Currently, EntityDAC does not support the work in multithreaded applications. We will add this possibility in one of the next builds of our product.

jwrz
Posts: 15
Joined: Mon 22 Aug 2016 05:30

Re: Working with threads

Post by jwrz » Tue 10 Jul 2018 13:34

Hi, this excludes use in the most popular business application model - multi-layered with server side logic (at least for IIS).

Could you more accurately estimate when it can be. We are working on the concept of a new project, if this time is not too long we can continue working with EntityDAC, otherwise I will have to choose another system (we have two or three months to take decision). We would prefer not to do it because already known it and it suits us (except for the lack of Eager Loading, but it is not critical - I hope you will implement it one day, so I could optimize queries in the future).

ZEuS
Devart Team
Posts: 236
Joined: Thu 05 Apr 2012 07:32

Re: Working with threads

Post by ZEuS » Fri 13 Jul 2018 10:49

We are already working on the implementation of this functionality. We plan to release the next release this autumn. In order for you to test the functionality, we will release a beta version within a month and provide you with it.

jwrz
Posts: 15
Joined: Mon 22 Aug 2016 05:30

Re: Working with threads

Post by jwrz » Mon 16 Jul 2018 10:40

Thank you very much for the information. I'm looking forward.

anykey
Posts: 8
Joined: Mon 14 May 2018 14:39

Re: Working with threads

Post by anykey » Thu 16 Aug 2018 14:30

According to the newly released v.2.0.1, Contexts are multi-threaded. I haven't noted any differences in this regard.

I'm working on a project where I have a Windows Service that has a main thread that spawns potentially dozens of worker threads. What I have done to is I have a dataModule in the project that has the EntityContext/EntityConnection etc., then I instantiate that data module in each worker thread. They play in their own memory pool. They live happily ever after.

The challenge becomes Thread A writes to an entity, Thread B could potentially have an older version in it's own cache. So, to combat that, before using the objects, you want to execute a .Reload of each entity first.

My front end is an IntraWeb 14 web app which of course is multi-threaded, and has plumbing to handle some of that for me. Each "UserSession" is managed under a class that has it's own DataModule (reused from the server project). Seems to keep everything partitioned.

Hope that helps?

Post Reply