Tag Archives: entity framework

The ObjectContext instance has been disposed and can no longer be used for operations that require a connection

TL;DR: Don’t return task before disposing context, await it instead If you’re getting an Entity Framework exception: System.ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection at System.Data.Entity.Core.Objects.ObjectContext.ReleaseConnection() at System.Data.Entity.Core.Objects.ObjectContext.d__3d`1.MoveNext() … Continue reading

Posted in Programming | Tagged , | Leave a comment

How to generate ids programmatically using SQL Server and Entity Framework

TL;DR: create a sequence and execute stored proc to read from it Generating ids in the database is used to be the default and near to the only one approach but now days this trend is fading away. Here’s some … Continue reading

Posted in Programming | Tagged , | Leave a comment

How to map linking table for many-to-many relationship using Entity Framework 6

TL;DR: use synonym. As promised earlier to myself, I blog about interesting challenges and the ways I solved them. The other day, me and my team faced a limitation in EF6: you can either configure a linking table for many-to-many … Continue reading

Posted in Programming | Tagged | Leave a comment