"At least one SSDL artifact is required for creating StoreItemCollection" Error with Entity Framework
I have recently been getting this error on my ASP.NET MVC project that uses the Entity Framework:
At least one SSDL artifact is required 开发者_如何学Cfor creating StoreItemCollection
The error occurs when I try to query the database in a controller action. Has anyone seen this error before? It only occurs every once in a while for me but I am looking for ways to resolve it.
EDIT: I am using Visual Studio 2008 SP1 so the version of Entity Framework should be version 1. I have also tried regenerating the EDMX file which has not helped.
I believe the issue was being caused by the pattern I was using with my ObjectContext. I was using a Singleton, which just didn't apply well with the ASP.NET MVC framework. I believe the ObjectContext was being disposed when I tried to use it again, hence the error.
I have moved to more of an 'ObjectContext Per Http Request' pattern, as described in this blog post. So far, this has worked much better.
Well, SSDL is part of your EDMX. It's recreated from scratch when you do an "Update Model from Database" in the GUI designer. So the first thing I'd do if I saw this is to connect to a DB with a known good schema and update model.
精彩评论