![](/img/trans.png)
[英]Error The model item passed into the dictionary is of type 'System.Data.Entity.DynamicProxies
[英]The model item passed into the dictionary is of type 'System.Data.Entity.DynamicProxies… and requires a model item of type
當我在“ Firmas”(通用自動生成的MS代碼)的索引中啟動“ Details”時出現此錯誤:
這是我的模型:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using actiTest2.Context;
using System.Data.Entity;
namespace actiTest2.Models
{
public class PcontacFirmasModel
{
public Pcontac pcontac { get; set; }
public Firmas firmas { get; set; }
}
}
我嘗試做atm的唯一電話:
@model actiTest2.Models.PcontacFirmasModel
@{
ViewBag.Title = Html.DisplayFor(model => model.firmas.NOMCOMP);
}
似乎在控制器端,您正在傳遞類型為“ Firmas”的對象,但是您的視圖期望使用的對象為“ PcontacFirmasModel”。
更新您的操作以發送PcontacFirmasModel對象。 您可以使用mapper實用程序來映射PcontacFirmasModel和Firmas。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.