开发者

Does having multiple web front ends and a single database back end fit into the MVC design pattern?

We have 3 websites at the moment that all operate off the same database backend and they share almost 100% of the business logic.

It is becoming a pain to have to update 3 website's code every time to accommodate a small change. Would using ASP.Net MVC work for us?

What I am thinking is the business logic and database is almost identical in all 3 so extract that away into the Model and the Control. Then each web front end (which looks different) each has a different View. It would then be Nice to have a single project where we can have all the code for the Model and Control shared. And 3 different views.

How would we deploy something like this? Share a single codebase for Model and Control and开发者_运维技巧 have 3 separate URLs using 3 different Views. Or is there a better way to do this?


You can probably pull it off using ASP.NET MVC, but you could also insert a service layer and use standard ASP.NET web services to expose it. Then each of your "views" could still be in its own little world, and just use the web services to grab and persist data.

ASP.NET MVC is probably a better solution in the end, but this is certainly an alternative.

One thing you do need to consider is if you want to keep these 3 sites on seperate domains. I'm not sure how ASP.NET handles keeping different views on different domains.


Sounds like you really need to implement a service layer (encapsulating the common business logic and data) that is used by n (thin) web apps. So think SOA.


This seems reasonable to me. In terms of the model and control you could consider dealing with any minor differences between the current models/controls using shared functionality in a base class and using inheritence to deal with exceptions.

If your web front end is only different in terms of look and feel then you may want to consider using the same code base but just swapping in different themes using CSS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜