views:

323

answers:

3

I've searched (google and SO) about this topic and couldn't find a thorough answer to my question(s).

I'm building an ASP.NET MVC 2 application that will be distributed to other people (with source code). These people will need to create modules/plugins that use the application's base.

The base is a simple ASP.NET MVC Application with Linq-To-Sql file, repositories, authorization/membership.

Is it possible to create a plugin that would work by simply adding a .DLL file in a folder?

Right now, you can create a "plugin" by opening the source project of the base application, creating a few controllers/views that do somethings, using the base application's authorization/membership and repositories. You would also be required to edit the Linq-to-Sql file and add in any tables that you need.

However, to "install" this plugin, I would need to copy the controllers/views for this plugin into my base application and edit the Linq-to-Sql class to include the tables necessary for this plugin, then build the solution. Is there a simpler method?

I read of .DLL plugins, but how would someone build a plugin like this starting from the base application.

If the 'plugin' creates tables with foreign keys of the "User" table in the main application, how does one separate those tables/relationships in a separate file and have the base application recognize those relationships?

As you can tell, I'm asking multiple questions that are kind of all over the place. This is a new topic/issue for me and I have no idea where to start. Theme mere concept of having my application interact with a separate .DLL file is foreign to me.

Any help/links would be greatly apprecaited.

A: 

I think this could be applied to mvc too: http://msdn.microsoft.com/en-us/library/ms972962.aspx

Gregoire
A: 

Does this answer the same question: http://stackoverflow.com/questions/340183/plug-in-architecture-for-asp-net-mvc?

queen3
The answer to that post is ~1 year old, and it dosen't address the issue ORM like Linq-to-Sql. A big issue is figuring out how to work with plugin tables that have FKs with the main application.
Baddie
As for associations (foreign keys) across assemblies, even Entity Framework did not support it (see http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/3d7925bc-ead7-4f1f-bfdf-68c8e5db024e/) - at the time of post. I doubt it is changed (and Linq-to-SQL is even less hope since it is "almost" discontinued). I'd suggest to try to look at EF, anyway; it is similar to Linq and more mature, so there're more chances you'll find what you need.
queen3
At least EF4, as far as I remember, seems to support programmatic changes (modifying mappings at runtime) so that's where your plugin can... plug in.
queen3
A: 

Good question. Now I faced with the same proble. Realization is in progress, but solution I think will be acceptable for me - create each module as separete MVC-project, then copy its binaries, Contents, Scripts and Views to main application and connect those binaries from main application using reflection or something like this. AS ORM I'm using EF 4 code-only and there will not limitations about splitting model between projects.

Veton