来自两个强类型模型的单个强类型视图 [英] single strongly typed view from two strongly typed models

查看:99
本文介绍了来自两个强类型模型的单个强类型视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是MVC和学习的新手.请帮助我,我被困在要从两个强类型模型创建强类型视图的位置.

例如,我有EmployerAccount和EmployerCompany模型.

我有一个创建视图,该视图应该获得有关loyalAccount和Employer Company的用户输入.

请帮助

问候

Hi,

I am new to MVC and learning things. Kindly help me that I am stuck in where I want to create a strongly typed view from two strongly typed model .

Say for an example I have EmployerAccount and EmployerCompany models.

And I have a create view, which should get user input for employerAccount and Employer Company.

Kindly help

regards

推荐答案

您无法开发可以使用多个模型的View.
但您可以通过开发虚拟模型来解决此问题,该模型具有您现有的两种模式的属性,
或者您可以开发具有两个成员的新模型,即现有模型类
或者您可以使用继承概念.
You can not develop the View that can use more then one model.
but you can fix this issue by either developing dummy model which has property from both existing mode you have,
or you can develop new model which has two members i.e. existing model class
or you can use the inheritance concept.


这篇关于来自两个强类型模型的单个强类型视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆