Hi,
I've done the following steps:
- Open visual studio
- Create new item
- Select "ADO.Net Entity Data Model"
- Point it to an existing database
- Accept all the defaults.
- It then adds a "Model1.edmx" file to my solution and the corresponding "Model1.Designer.cs" file.
However in the output I get the following error:
"ERROR: Unable to generate model because of the following exception: 'Value does not fall within the expected range.'."
I've created a model from this database before so I dont think the error is a result of complex table design (which it's not).
Has anyone else hit this error?
Thanks
-
Ok....
I think I might have a solution. I've just done the following and it worked.- Create a new project
- Add an Ado data model to it.
- So the ONLY thing in the project is the model and it does not reference any other projects so it can stand and build on it's own.
- I got the error I was mentioning above in this project
- Delete the Model1.edmx file.
- Remove the project reference to "System.Data.Entity.dll" (this was the key)
- Delete the connectionStrings out of "App.config"
- Rebuild the Project
- Add the "ADO.Net Entity Data Model" back into your project.
It now works.
Un-nerving.
But it works. -
Fun fun fun.... I'm back at the starting block again. Just followed all my steps listed and it's still not working.
When I double click on "Model1.edmx" nothing happens. It does not open the design view.
Will battle this out and put another post up when I find a resolution. Joy.
-
Ok.
I was able to readd it. Here's what I did.All the steps above in the bullet points plus:
- Shut down Visual Studio 2008
- restart Sql Server 2005
- Reopen Visual Studio 08.
Still stumped on how to resolve this.
-
I had a similar problem. The reason was pretty simple. I've forgotten to set a primary key in one of my tables. Hope it helps.
-
Please check whether the primary key has been defined for the table. If you open the entity model in xml editor, you should be able to see commented error message, the comment might help you!
-
When I'm unable to open the 'Design View' while clicking on the model.edmx file I Unload the project in VS2008 and then load it back up again and it seems to fix that problem.
-
Hi Garth, You can add one table to the model first and when the edmx file is created, you can update model from the database. It worked for me. I wish it solve ur prblem too.
cheers Parminder
0 comments:
Post a Comment