Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an ASP.NET MVC 3 control/component that can be reused by other applications

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.

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.

  • 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?

  • 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?

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.

like image 543
famousgarkin Avatar asked Nov 11 '11 11:11

famousgarkin


2 Answers

This article tells how to call controllers from another assemblies.

To reuse only views, you can use RazorGenerator.

like image 70
rcaval Avatar answered Oct 31 '22 13:10

rcaval


I recommend you to refer the MVC Control ToolKit Project page of CodePlex

Also see ASP.Net MVC Sprite Project

like image 40
Prasanth Avatar answered Oct 31 '22 14:10

Prasanth