我有以下课程 -
public abstract class BusinessObject { }
public abstract class Form: BusinessObject { }
public abstract class BillableForm: Form { }
public class MembershipForm: BillableForm { }
public abstract class Dto<T>: where T: BusinessObject { }
public abstract class InboxDto<T>: Dto<T> where T: Form { }
public class MembershipFormDto: InboxDto<MembershipForm> { }
我有以下看法——
membershipform.cshtml:
@model AdminSite.Models.MembershipFormDto
@{
Layout = "~/Views/Inbox/Shared/_LayoutForm.cshtml"
}
_LayoutForm.cshtml:
@model InboxDto<Form>
当我登陆 membersform.cshtml 页面时,我收到以下异常说明:
传入字典的模型项的类型为“AdminSite.Models.MembershipFormDto”,但该字典需要类型为“AdminSite.Infrastructure.Models.InboxDto`1[BusinessLogic.Inbox.Form]”的模型项。
从我所知道的一切来看,MembershipFormDto
IS-AInboxDto
类型MembershipForm
,其中MembershipForm
IS-A Form
。是什么赋予了?