I created an EntityModel in Visual Studio 2010 to use with Linq. What I see in my Model Browser are:
>AcrrualEntityModel.edmx
>>SteeringWheelModel
>>>Entity Types
>>>>TblFTEReportNew
>>>>>Field1
>>>>>etc..
In my Default.aspx.cs file I should be able to call SteeringWheelModel. This object is generated with the Entity Data Model Wizard. I can see the tables and fields in the model. So, the connection to the database works.
However, in my Default.aspx.cs file I should be able to create a new instance of SteeringWheelModel, so I can use Linq to use tables and fields.
Intellisense does not pick it up. The compiler does not recognize SteeringWheelModel.
What am I missing here? Some "using", some reference?
Thanks in advance!
Roy
You need to import the namespace of EntityModel class by adding a using statement to your code behind. Ex:
Alternatively you could make sure they are in the same namespace, but I do not recommend that. Also, if these files are in differenet projects make sure your UI project has a reference to the EntityModel project.
Edit: To try to show you what I mean.
Here is a section of one of my projects. Each folder here has a different namespace.
If I want to reference a class in another UI project i first need to add a reference to the data assembly to the UI project and then inside the UI project I need to import the namespace ex: