如何创建一个ASP.NET MVC 3控制/组件,它可以被其他应用程序重用 [英] How to create an ASP.NET MVC 3 control/component that can be reused by other applications

查看:98
本文介绍了如何创建一个ASP.NET MVC 3控制/组件,它可以被其他应用程序重用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要提供一个组成部分,计有业务逻辑和用户界面,对正在由其他公司开发的ASP.NET MVC 3网站上使用。

I am required to deliver a component, inlcuding business logic and UI, to be used on a ASP.NET MVC 3 web site that is being developed by other company.

我知道我的身边ASP.NET WebForms的服务器控件的方式,以及如何打包和分发他们在不同项目中重复使用。我也有一般的MVC方法和一些ASP.NET MVC的体验心得。我也读了,建议使用HTML佣工和类似的材料,但大多数的这用一个ASP.NET MVC项目中唯一的用户界面的可重用性和可重用性交易。我没有找到任何提及如何打包和ASP.NET MVC分发这些功能。

I know my way around ASP.NET WebForms server controls and how to package and distribute them to be reused across projects. I also have experience with MVC approach in general and some ASP.NET MVC experience. I did read over materials recommending use of HTML helpers and similar, but most of this deals with only UI reusability or reusability inside a single ASP.NET MVC project. I did not find any mentions of how to package and distribute such functionality for ASP.NET MVC.

业务逻辑组件的主要部分。它应该是一种精灵,它通过进步了很多步骤,这也将与数据库中使用实体框架的工作,并完成后发送电子邮件给用户。

The business logic is major part of this component. It is supposed to be a kind of wizard, which progresses through a lot of steps and which would also work with database using Entity Framework and send an email to the user upon completion.


  • 我怎么会去创建一个控件/组件封装复杂的业务逻辑,也使得自己的UI /查看输出,并且将在一个独立的组装形式分配?这甚至可能还是只在某种程度上?

  • How would I go about creating a control/component that encapsulates complex business logic and also renders its own UI/view output and that would be distributable in form of a standalone assembly? Is this even possible or only to some extend?

这会在某种程度上是通过包装组件内的模型,视图和控制器是可行的?

Would this somehow be doable by wrapping model, view and controller inside an assembly?

还是会得到更好的解决这个只是作为一个复杂的模型?如果是这样,怎么会是可以通过组件的消费者对UI /视图和控制器来此组件连接?

Or would it be better to approach this just as a complex model? If so, how would it be possible to connect the UI/view and controller to this component by the consumer of the component?

我也确实看到了一些供应商那里,如Telerik的,谁卖沿着ASP.NET MVC控制/组件线的东西,所以我认为这是某种可以做到的。

I also did see a couple of vendors out there, such as Telerik, who sell something along the lines of ASP.NET MVC controls/components, so I assume this is somehow possible to do.

推荐答案

<一个href=\"http://$c$cclimber.net.nz/archive/2008/11/14/how-to-call-controllers-in-external-assemblies-in-an-asp.net.aspx\"相对=nofollow>这篇文章讲述如何调用来自另一个组件控制器。

This article tells how to call controllers from another assemblies.

要重用只有视图,可以使用 RazorGenerator

To reuse only views, you can use RazorGenerator.

这篇关于如何创建一个ASP.NET MVC 3控制/组件,它可以被其他应用程序重用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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