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

2

9

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.

Reynolds answered 11/11, 2011 at 11:33 Comment(1)
I think this is what you are looking for. #6657343Maneating
U
3

This article tells how to call controllers from another assemblies.

To reuse only views, you can use RazorGenerator.

Unhair answered 29/12, 2011 at 14:31 Comment(1)
I'm currently using RazorGenerator to stick common views in our common library, and it really does the trick. You could wrap everything you are looking to do into a single assembly and be good to go.Hyohyoid
C
2

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

Also see ASP.Net MVC Sprite Project

Chesterfield answered 11/11, 2011 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.