Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ASP.NET MVC Views be re-used across different projects?

This is a follow-up question to this question.

It's a nice solution to sharing common Views across many projects using source control. However I have a couple of questions, specific to Subversion I think.

Subversion Externals allows you to include a folder from a separate repository in your working copy, so you could define an "External" property on the working copy root that added a folder: [/Web/Views/Forum] for example.

  1. What would happen if you wanted to override one of these views with a version specific to one of the dependant projects?
  2. If you added an additional View in that folder, would SVN commit it to the shared repository?

Is the answer at this stage "wait for MVC2", as I believe it is better for these kind of scenarios?

Thanks, GC

like image 792
GC. Avatar asked Nov 06 '22 17:11

GC.


1 Answers

svn:externals are not the answer to your problem

Just to clarify: when using svn:externals, you're really adding a link to the actual external repository. Whatever you modify/add/delete and commit (given that you have commit access to the external repository) from your working copy will simply get committed to that repository. Everyone else using the same repo (as external or not) will get those changes on a subsequent update.

If you really need to be able to modify the views, you will have to work out a branching & merging scheme I'm afraid. If that is the case, make sure it's really worth the trouble.

EDIT: As an answer to the original question, I think your best bet is to wait for ASP.Net MVC 2. You may want to have a look at this series of blog posts by Eric Hexter, explaining 'Portable Areas' with mvc2 and mvccontrib

like image 90
jeroenh Avatar answered Nov 12 '22 22:11

jeroenh