0

I have a mvc web project and other project where I have entities from "Database first" entity approach. I referenced Entities project into my Web project as seen on image below

Structure: http://i.imgur.com/h5ZppiG.png

Now I created simple controller with automatic CRUD operations.

The error I get is still complaining about not having Entities referenced: http://i.imgur.com/1jaVqr9.png

This is how type is implemented in View:

@model IEnumerable<Entities.Users>

What seems to be the problem?

4

2 回答 2

0

You need to register the assembly for the razor view engine.

You can put it in the Web.Config that exists in your Views folder.

<system.web>
  <controls>
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
    <add yourassembly here />
  </controls>
</system.web>

How to register assembly in Razor view engine

于 2013-10-06T14:10:43.900 回答
0

The problem was that I had this model inside of Console Application, which doesn't create .dll file. It creates only .exe.

I created class library which stores only Model from database first entity approach, and creates .dll. Now it works.

于 2013-10-06T16:51:56.857 回答