Last post Aug 14, 2012 02:25 PM by Yaniv Nabati
Mar 06, 2012 04:24 PM|wonjartran|LINK
Followling the ASP.NET MVC Tutorials, Chapter 2 Get Started with ASP.NET MVC3,
I have created a Model class, Game.vb and a connectionString with our SQL Server 2008 database.
ConnectionString in web.config
Source=MyWebServer;Initial Catalog=Games;Persist Security Info=True;User ID=aaa;Password=bbbccc"
Then, I tried to create a new controller using Entity Framework, as shown below. (MvcMovies is the name of the MVC project.)
Template: Controller with read/write actions and views, using Entuty Framework
Model class: Game(MvcMovies)
Data context class: GameDBContext(MvcMovie)
Error message popped up. Waht's wronng?
Mar 06, 2012 05:45 PM|wonjartran|LINK
FYI: Below is the connectionString in the web.config for the SQL Server Compact database, as shown in the Tutorial.
Mar 06, 2012 07:54 PM|wonjartran|LINK
In addition to creating the Game.vb, then GameController, I have successfully created 2 ADO.NET EDM's,
Movies.edmx and MovieCategories.edmx. Two connectionStrings with names, databasenameEntity, were
created automatically in the web.config for these 2 edmx modelx. Then 2 controllers were created
successfully for accessing these 2 edmx models.
For the Code-First Game,vb model class, why I can not create a controller for this model?
What does "can not find the CLR type for MvcMovie.Game: mean??? My understanding is
the Games database will be created in SQL Server database automatically. I am sure the
user name can create new database.
Mar 06, 2012 08:03 PM|wonjartran|LINK
I created the Games database with the SSMS. Tried to create the GameController again,
still got the same error.
Mar 09, 2012 04:27 PM|wonjartran|LINK
To make sure I did not misss something from Microsoft Entity Framework, I installed
ADO.NET Entity Framework Feature CTP5, in addition to EF 4.1. Still got the same error msg.
Mar 09, 2012 04:40 PM|raduenuca|LINK
Have you compiled the project? You need to compile in order to use scaffolding
Mar 09, 2012 04:46 PM|wonjartran|LINK
Yes, I clicked the Build menu to build the Project.
Apr 09, 2012 05:10 PM|wonjartran|LINK
In this ASP.NET MVC Tutorials, Chapter 2 Get Started with ASP.NET MVC3, the 'Adding a Model' section
asked us to use the 'EF Code First' to create a model class, then in the following section 'Accessing your
Model's Data from a Controller' we can create a new controller based on this model class with a DBContext class.
Somehow I still got the erro -- Unable to retrieve metadata for 'MvcMovie.Game'. Could not find the CLR type
for 'MvcMovie.Game'. MvcMovie is the name of the ASP.NET MVC project and Game is the name of model.
Checking the version of the VS 2010 found:
Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Versiobn 4.0.30319 SP1Rel
Also the Program Files of C:\ drive showed Microsoft ADO.NET Entity Framework Feature CTP5 and Microsoft.NET Entity Framework 4.1
Any answers for my 'Could not find the CLR type' error?
May 09, 2012 07:28 AM|everynameichooseistaken|LINK
No answers, I'm afraid - just more questions... ;)
I'm new to ASP.Net & having the exact same issues - I'm using SQL Server 2008 as well. I'm sure my connection string is good, as I got Linq to generate one & it is the same
(connectionString="Data Source=myMachine;Initial Catalog=MyDB;Integrated Security=True"
When I try to add the controller class it throws exactly the same error. Did you ever resolve this? If so, what was the problem/solution?
May 09, 2012 04:56 PM|wonjartran|LINK
First, my problem was with the so-called code first, not model first or database first. Later on I tried another ASP.NET MVC Tutorial,
I had no probelm to create the code-first controller. In this EF Data Model project, the database context was created in a DAL folder.
In another MVC project with problems in creating a new controller, I had several classes in the Model folder, including the
MovieVB.vb and Movie.edmx. I am not sure if this is the problem. Anyway, just follow the above link to create an EF data model for a code-first new controller.
May 23, 2012 10:23 PM|wonjartran|LINK
Followling the ASP.NET MVC Tutorials, Adding a Model, in the Chapter 1: Get Started with ASP.NET MVC3,
I re-started this tutorial with a new ASP.NET MVC 3 project, then created a Model class,
Game.vb and a
connectionString with our SQL Server 2008 database. Finally, I have successfully created a new
by working on the Tutorial, Accessing your Model's Data from a Controller.
The new project worked very well, I can open the ASP.NET MVC 3 page and add 2 new data by clicking the
Create New link. The new data entered was displayed in the SQL Server 2008 database, as coded in th
connectionString of the Web.config file.
Aug 14, 2012 02:25 PM|Yaniv Nabati|LINK
i have the same issue (follow the MVC 4 tutorial) after i change the name of the connection string (web.config) from "MovieDBContext" to "DbContext"
it's work !