unable to retrieve metadata for mvc entity data model could not find clr type of tblEmp Entity

Posted by Justkishor under ASP.NET MVC on 2/1/2015 | Points: 10 | Views : 5060 | Status : [Member] | Replies : 1
I have Add EntityDataModel.edmx which having two tables that are inter related each other as tblDepartment and tblEmployee.
My database name is "Form1" and Model Namespace is "Models" and Data Context Class is EmployeeContext and then I build the solution.
When step 3: Right click on the "Controllers" folder and select Add - Controller. Set
Name = EmployeeController
Template = MVC controller with read/write actions and views, using Entity Framework
Model class = tblEmployee(MVCDemo.Models)
Data Context Class = EmployeeContext(MVCDemo.Models)
Views = Razor
I got error "unable to retrieve metadata for mvc entity data model could not find clr type" in dialoug box.Please help me for this...


Posted by: kgovindarao523-21772 on: 2/2/2015 [Member] [MVP] Bronze | Points: 25


You have two tables which are tblDepartment and tblEmployee.
As per your explanation, Employee has a department, so, tblDepartment has a column suppose DepartmentId which is a foreign key to tblEmployee.
Apart from this, I think the reason for error is, the tables which are going to add to your EDMX must have primary key columns. If not set primary key columns and recheck.

Please mark as answer if you got solution, else revert back your queries.

Thank you,

Justkishor, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response