Can you post the namespace of your webapp and your model?
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
If you are not able to refer the model from the AddControl dialog, then you need to rebuild the project. Sometimes the model doesn't show up.
In extreme cases, you need to close and open the visual studio.
(The above is true, is all other steps, like referencing dlls are done correctly.)
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
phani25485
Member
107 Points
196 Posts
MVC could not refer enitity model
Mar 22, 2012 08:35 AM|LINK
Hi i am trying to create a sample MVC app from thsi link
http://blogs.msdn.com/b/brada/archive/2008/01/29/asp-net-mvc-example-application-over-northwind-with-the-entity-framework.aspx
In the model i have created a entity, NorthwindModel
now In the controller i am unable to refer to this entity namespace like using NorthWindModel
thinkrajesh
Participant
1356 Points
232 Posts
Re: MVC could not refer enitity model
Mar 22, 2012 08:36 AM|LINK
Is the model in the same assembly?
Can you post the namespace of your webapp and your model?
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
ignatandrei
All-Star
134857 Points
21611 Posts
Moderator
MVP
Re: MVC could not refer enitity model
Mar 22, 2012 08:44 AM|LINK
did you add the reference to other project?
phani25485
Member
107 Points
196 Posts
Re: MVC could not refer enitity model
Mar 22, 2012 08:52 AM|LINK
yes the model is in the same assembly
THis is the namespace of my application
the model namespace is
rajeshw610
Member
20 Points
14 Posts
Re: MVC could not refer enitity model
Mar 22, 2012 09:04 AM|LINK
Hi,
You may try following steps:
1. check namespace of entity data model & name of the class which inherits from ObjectContext class from designer.cs file(inside youdatamodel.edmx)
2. add reference of you data model project in the project consisting of controllers(if required) & include the namespace in your controller
3. now u should be able to refer to data model class in your controller
phani25485
Member
107 Points
196 Posts
Re: MVC could not refer enitity model
Mar 22, 2012 09:14 AM|LINK
I will explain you clearly the steps that i have done
first i have taken a asp.net mvc 2 project
there are not multiple projects, simple three folders mvc
right clicked model and add new item-ado.net entity model and generated model from database
now right clicked controller add controller.
now i am unable to refer to the entity in the model by using , it is not refering
thinkrajesh
Participant
1356 Points
232 Posts
Re: MVC could not refer enitity model
Mar 22, 2012 12:49 PM|LINK
If you are not able to refer the model from the AddControl dialog, then you need to rebuild the project. Sometimes the model doesn't show up.
In extreme cases, you need to close and open the visual studio.
(The above is true, is all other steps, like referencing dlls are done correctly.)
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
phani25485
Member
107 Points
196 Posts
Re: MVC could not refer enitity model
Mar 24, 2012 03:09 AM|LINK
What other dlls i need to refer,
strill nto getting
i even tried with linq to sql
Young Yang -...
All-Star
21345 Points
1818 Posts
Microsoft
Re: MVC could not refer enitity model
Mar 29, 2012 04:02 AM|LINK
Hi
Did you create the template file?
http://msdn.microsoft.com/en-us/data/gg685489
Hope this helpful
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store