2
Reply

SEARCHING IN MVC

ajay pandey

ajay pandey

Jun 12 2015 3:13 PM
503
Hi,
I am Getting a Problem. Please Help.
 I am not getting Model Class In the Step 3. Please See Below. In Red Line i have mention the Error.
 
We will be using table tblEmployee for this demo. Use the script below to create and populate the table with sample data.
Create table tblEmployee
(
ID int identity primary key,
Name nvarchar(50),
Gender nvarchar(10),
Email nvarchar(50)
)

Insert into tblEmployee values('Sara Nani', 'Female', '[email protected]')
Insert into tblEmployee values('James Histo', 'Male', '[email protected]')
Insert into tblEmployee values('Mary Jane', 'Female', '[email protected]')
Insert into tblEmployee values('Paul Sensit', 'Male', '[email protected]')

Step 1: Create an empty asp.net mvc 4 application.

Step 2: Generate ADO.NET entity data model from database using table tblEmployee. Change the entity name from tblEmployee to Employee. Save changes and build the application.

Step 3: Add HomeController with the following settings.
a) Controller name = HomeController
b) Template = MVC controller with read/write actions and views, using Entity Framework
c) Model class = Employee
d) Data context class = SampleDBContext
e) Views = Razor 
 
 I am Getting Model Class =tblEmployee.
And If I am Selecting this then Getting The Error"Unable To Retrieve metadata for 'MVCDemo.Models.tblEmployee' . Could Not Find The CLR type for 'Models.Employee' .
Please Help.
Thanks,
Ajay 
 
 

Answers (2)