Coder Social home page Coder Social logo

demo-multi-tenant-asp.net-mvc4's Introduction

Multit-tenancy using SimpleMembership
-------------------
Requirement:

- Visual Studio 2012
- .Net framework 4, MVC 4
- MS SQL Server 2008 R2

-------------------
Step by step:

Step 1:
	- Attach database with 'ort.mdf' or restore with 'ort.bak' to MS SQL Server, we also create database by query 'ort.sql'
	- Create an account and set all roles for it: username: ort, password: ort@1234
Step 2:
	- We have to reset connection string to server stored the data on web folder at 'TenantID/Web.config' and 'TenantURL/Web.config'
	- Open project with Visual Studio 2012 or add the website to IIS to debug it

Step 3:
	- Test with default accounts on database that's we retored:
		usernam: hunglx, pw: hunglx or username: admin, pw: adminadmin
	
	- If we created database by query then on the website > we have to register an account.
	- Login to website and register a tenancy at 'Tenant control', for example:
		Tenant user: as username
		Theme: 'cnn' or 'bbc'
		Tenant schema: 'cnn' or 'bbc'
		Tenant Connection: Data Source=cn1.data.vology.com,1433;Initial Catalog=ort;persist security info=True;user id=ort;password=ort@1234;MultipleActiveResultSets=True;App=EntityFramework
	- Click to "Keep your news" to create an record on database seperated distinguish schema 'cnn.News' and 'bbc.News'. Each account is set up in 'Tenan control' will correspond generally used on a table News


-------------------
Reference appendix:

Tenant ID
localhost/default/register ~ login
localhost/controller/action/id ~ different UI

Tenant URL Routing
localhost/default/register	~ different UI
localhost/tenant/controller/action/id ~ different UI
localhost/tenant/controller/action/id ~ different UI


There are a number of options for identifying the tenant from a web request.

Tenant ID
- Authentication. If users accessing the site must authenticate, the site can determine the tenant from the authenticated identity.

URL ROUTING
- The URL path. For example, Web’s tenants A and B could use:
        http://localhost/A/id
        http://localhost/B/id

- The subdomain. For example, Web’s tenants A and B could use 
         http://a.localhost/id 
         http://b.localhost/id

- A custom domain. For example, Web’s tenants A and B could use 
         http://localhost.b.com
         http://localhost.a.com

http://msdn.microsoft.com/en-us/library/hh534477.aspx
http://www.sapiensworks.com/blog/post/2012/03/01/AspNet-Mvc-Routing-With-Multi-Tenant-Support.aspx
http://www.developer.com/design/article.php/3801931/Introduction-to-Multi-Tenant-Architecture.htm
http://msdn.microsoft.com/en-us/library/aa479086.aspx
http://www.dennisonpro.info/simple-multitenancy-with-asp-net-mvc-4/
http://www.codeproject.com/Articles/51334/Multi-Tenants-Database-Architecture

demo-multi-tenant-asp.net-mvc4's People

Contributors

tonylehung avatar

Stargazers

Benjamin Raabe avatar Ebubekir Dogan  avatar HauLe avatar n3xpect avatar mehrdad avatar

Watchers

Dustin Hotard avatar  avatar James Cloos avatar

demo-multi-tenant-asp.net-mvc4's Issues

Run db migrations error

Hi, on each new tenant, it says, run migrations, Is there a way to auto-run migrations from code? I have tried some code snippets for auto-run migrations from code but none of them seems to be working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.