Last post Mar 29, 2012 04:02 AM by Young Yang - MSFT
Mar 22, 2012 08:35 AM|phani25485|LINK
Hi i am trying to create a sample MVC app from thsi link
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
Mar 22, 2012 08:36 AM|thinkrajesh|LINK
Is the model in the same assembly?
Can you post the namespace of your webapp and your model?
Mar 22, 2012 08:44 AM|ignatandrei|LINK
did you add the reference to other project?
Mar 22, 2012 08:52 AM|phani25485|LINK
yes the model is in the same assembly
THis is the namespace of my application
the model namespace is
Mar 22, 2012 09:04 AM|rajeshw610|LINK
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
Mar 22, 2012 09:14 AM|phani25485|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
Mar 22, 2012 12:49 PM|thinkrajesh|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.)
Mar 24, 2012 03:09 AM|phani25485|LINK
What other dlls i need to refer,
strill nto getting
i even tried with linq to sql
Mar 29, 2012 04:02 AM|Young Yang - MSFT|LINK
Did you create the template file?
Right click on the model’s designer surface. From the context menu, choose Add Code Generation Item. In the Add New Item dialog that opens, select Code from the list of installed templates types on the left.
Choose the ADO.NET DbContext Generator then click the Add button.
Hope this helpful