1

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.

Omar
  • 39,496
  • 45
  • 145
  • 213

2 Answers2

1

Does this answer the same question: Plug-in architecture for ASP.NET MVC?

Community
  • 1
  • 1
queen3
  • 15,333
  • 8
  • 64
  • 119
  • 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. – Omar Nov 05 '09 at 02:12
  • 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 Nov 05 '09 at 08:19
  • 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 Nov 05 '09 at 08:22
0

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

Gregoire
  • 24,219
  • 6
  • 46
  • 73