这是view中的model代码:

@model t_user_info

这是web.config配置文件只的代码:

      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="CeramicMasterApp" />
        <add namespace="CeramicMasterApp.Models" /> <!--新添加  20160804 添加完要重启VS-->
      </namespaces>

这样就不用在每个要使用model 的视图view 中都添加如下的代码:

@using CeramicMasterApp.Models;

 不过,在添加完,需要重新启动vs,要不然就因为识别不出model报错。

相关文章:

  • 2022-12-23
  • 2021-07-08
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2021-05-10
  • 2021-12-29
  • 2021-05-30
  • 2021-07-22
  • 2021-08-21
  • 2022-12-23
相关资源
相似解决方案