Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quickest way to implement multi tenant ASP.NET MVC Application

I think I am not getting the meaning of any of this. My purpose is to create a multi tenant ASP.NET MVC Application.

I saw a great post on how to do this here , but Nhibernate isn't an option.

One of the things I want to understand is: Is MVC (along with everything else) supposed to help in creating multi tenancy web apps?

I have seen several comments which are similar to my question, but they often don't appear to hit the same point I am trying to get at:

  • One DB
  • One Schema
  • No Nhibernate

If anyone knows of a simple explanation as to how this can be done, I appreciate it.

the contents on this page are all I know on the subject, what I wish to be able to understand is how MVC (if at all) helps in getting it done and if it makes it simpler or not.

Many thanks,

Ric

like image 981
Ric Tokyo Avatar asked Jun 10 '09 09:06

Ric Tokyo


People also ask

How do I create a multi-tenant application?

There are three approaches on how to build a multi-tenant application: Database per tenant — each tenant has its database. Shared database, separate schema — all tenants are using the same database, but each tenant has his schema. Shared database, shared schema — all tenants are using the same schema.

What is the benefit of deploying application in multi-tenant environment?

There are many advantages to implementing a multi-tenant application environment. A multi-tenant application can provide savings by reducing development and deployment costs to companies that develop applications. These savings can be passed on to customers – increasing competitive advantages for all parties involved.


2 Answers

The closest thing to answer my question here, that I can find myself is the read on Mike Hadlow's blog

Its detailed, but to the point, and I downloaded the SutekiShop app.

I haven't yet reached the AHA! Moment yet, but it seems close.

I believe the way he has implemented the multi tenancy was with the role id, I guess now I just have to keep reading and tweaking.

His latest post (afaik) on the subject seems to address the issue with WCF use.

like image 163
Ric Tokyo Avatar answered Oct 05 '22 22:10

Ric Tokyo


The thinks I like about MVC for multitenant applications are:

  • You can choose the View according to your tenant

That was never easy in Webforms. Its easy to implement something in MVC like: There is a default View for every tenant, but if a tenant needs a special View, then the special View is taken. You will have to extend the Viewengine a little bit.

  • You can have Business Rules according to the tenant by using IoC

By using StructureMap or others you can swap parts of your ServiceLayer

I have one DB per tenant so I will not be of help at the DB - part.

like image 39
Mathias F Avatar answered Oct 06 '22 00:10

Mathias F