FetchEntityCollection return null on multi thread

Posts   
 
    
Posts: 2
Joined: 08-Oct-2018
# Posted on: 08-Oct-2018 13:53:33   
  public void FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, int maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath);

return null in collectionToFill if there exist multi thread(huge request count in same time for same database record). llblgen pro version: 5.0.0.0 Runtime version: v4.0.30319

at System.Data.ProviderBase.DbConnectionClosedConnecting.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.OpenConnection() in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 853

The DataAccessAdapter class is not thread safe and should not be used as such. Each thread should use its own instance, it's not safe to share a DataAccessAdapter instance among multiple threads.

Thats true even on newest versions?

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 08-Oct-2018 18:30:18   

The DataAccessAdapter class is not thread safe and should not be used as such. Each thread should use its own instance, it's not safe to share a DataAccessAdapter instance among multiple threads.

Thats true even on newest versions?

Indeed.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Oct-2018 09:20:57   

It takes almost no time to instantiate one, so sharing an instance among threads isn't needed.

Frans Bouma | Lead developer LLBLGen Pro