Skip to main content
18 events
when toggle format what by license comment
Sep 17, 2023 at 14:59 comment added Ccm The solution is to not share the DbContext unless you are very aware of what you are doing. EF is designed so you can spawn a large number of DbContext instances so you shouldn't worry about resource optimization.
Sep 17, 2023 at 12:30 history protected gnat
Sep 17, 2023 at 12:02 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
May 20, 2023 at 12:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Jan 22, 2023 at 12:37 comment added Turksarama Your problem is lower level than you realise. You shouldn't even be using a repository pattern with Entity Framework, as it is already a repository.
Jan 20, 2023 at 11:08 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Dec 21, 2022 at 10:50 answer added Saï timeline score: 1
Jul 10, 2019 at 21:00 history tweeted twitter.com/StackSoftEng/status/1149060794430251009
May 23, 2017 at 12:40 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Oct 7, 2015 at 13:56 comment added Sven Grosen @Euphoric the intent of my post is not to complain about how EF contexts work, but to ask for suggestions on how to communicate that a given subset of repo operations are bound to EF and therefore cannot be done in parallel when using the same context. I'm new on this project and unfamiliar with EF conventions, so it is entirely possible that the established organization is "spaghetti", but I'm inclined to think not.
Oct 7, 2015 at 13:45 comment added Euphoric @SvenGrosen The "workaround" is to use Context in single thread only. EF is not going to change just because your code is massive spaghetti and it is impossible to know from which thread the Context will be called.
Oct 7, 2015 at 13:43 comment added Sven Grosen @Euphoric I meant discussion around ways to work around this limitation, which I certainly understand why it is in place. Again, I'm an EF newbie so my whole line of thinking is probably naive.
Oct 7, 2015 at 13:40 comment added Euphoric @SvenGrosen There is no need for discussion. Context is not thread-safe and it is stressed enough that it should only ever be accessed from single thread/continuation chain.
Oct 7, 2015 at 13:36 comment added Sven Grosen @Caleth that is an excellent, succinct way of putting it and makes me wonder why there aren't more discussions about this issue with EF (or maybe everybody is creating contexts for each async request).
Oct 7, 2015 at 13:35 history edited Sven Grosen CC BY-SA 3.0
Added link to SO question dealing with this issue
Oct 7, 2015 at 13:11 comment added Caleth if sharing the DataContext means that you can't really claim to be a Task, either don't share the DataContext or don't claim to be a Task
Oct 7, 2015 at 13:04 review First posts
Oct 7, 2015 at 14:18
Oct 7, 2015 at 13:00 history asked Sven Grosen CC BY-SA 3.0