I have a few views in my database that im using in my ASP MVC-application. Now I am experiencing a very strange problem. There are 8 views in开发者_如何学Python the database but even if I check them all in the Create Enity Data Model-guide only 7 of them are available as objects in the datacontext.
If I try to import ONLY the view that gets left out I get an empty model.
Is there some kind of limitation that I dont know of? Or is this a known problem?
Sounds like there is something special with this view. Things to check:
- Are the rights the same on this view as others?
- Try running a select on this view from query manager to confirm that it works
- Open up the "empty" model in an xml view and see if there are any error messages in it
I have ran into issues importing tables and views with no key defined. The entity framework will try to assign one automatically if it can, but if you have duplicate data you may have to create a primary key before EF will bring it in.
That didnt do the trick. I removed all joins from the view definition and added a very simple view (basically just a select from a single table). That worked. Then I added the joins one by one and made the view more complicated for each step. Now I have the same view as I had before I started this process and I can now import it without problems. Something is strange in the state of Denmark
精彩评论