EF5: Avoid deadlocks by connection reusage and allow usage of CreateDatabaseIfNotExists DB initializer ------------------------------------------------------------------------------------------------------
Key: DNET-524 URL: http://tracker.firebirdsql.org/browse/DNET-524 Project: .NET Data provider Issue Type: Improvement Components: Entity Framework support Affects Versions: 3.2.0.0 Environment: EF 5 on .NET 4.0 and probably 4.5 Reporter: Mark Junker Assignee: Jiri Cincura # Avoid deadlocks by connection reusage: #* Assume that you have both an IDbSet<T1> and IDbSet<T2> #* Use a TransactionScope() #* Create the DbContext #* Create an instance of T1 where you initialize a property T1.X with an instance of T2 queried from the IDbSet<T2> #* Add the instance of T1 to the IDbSet<T1> #* Call SaveChanges() #* Results in a no wait lock because: #** Adding the instance of T1 partially loads the IDbSet<T1> and therefore creates a lock on the table #** SaveChanges() reopens the existing connection which produces a new FbConnectionInternal which tries to write something to a locked table #* Solution: Reuse the internal connection when the FbConnection gets reopened # Allow usage of CreateDatabaseIfNotExists DB initializer #* There's a call to context.Database.Exists() while a new TransactionScope(TransactionScopeOption.Suppress) is active #* Solution: Allow Enlist without an active transaction -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider