Wrox Programmer Forums
|
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2011, 05:35 PM
Authorized User
 
Join Date: Dec 2010
Posts: 23
Thanks: 3
Thanked 2 Times in 2 Posts
Default Multi-Tenancy

Scott,
I'm curious what your thoughts are on strategy/architecture for handling multi-tenant systems and using an OR/M like NHibernate or EntityFramework? For example, I might want to have 1 Agathas Storefront code base that is shared among different storefronts in the same database backend.

Each Agathas Storefront would have different products, orders, settings, catalog, etc. In the past I have accomplished this by using some kind of top-level DB table and having all the other DB tables keep a FK reference.

For example, 2 DB tables might be:
[STOREFRONT]
Id int PK,
Name nvarchar(500)

[STOREFRONT_PRODUCT]
Id PK int,
StorefrontId int FK,
ProductName nvarchar(500),
Price float

Should the Domain Model be modeled to show/describe the multi-tenant concept? Or should the Domain Model be modeled from the perspective of a single storefront within the multi-tenant system?

Last edited by ksouthworth; January 25th, 2011 at 05:38 PM..
 
Old January 27th, 2011, 09:34 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi ksouthworth,

I am assuming that we are talking about the same company having different shops. Maybe like a smaller version of Amazon that may have different products on Amazon.co.uk to Amazon.com.

With my domain hat on I guess I ask the question:
  • Do I care about what other shops sell when customers are browsing the catalog?
    If no then its not a concern of your domain.
With my programmer hat on I ask the following question:
  • How can display products specific to my shop that are stored in shared tables with other shops?
If we are just talking about the presentation of the product catalog I would create views for Nhibernate and add the store id in some kind of config file so that it could add as a parameter for all calls for the products.

When it comes to the managment of products then I would have a full blown domain and yes then products do care about what shop they are sold in, or better put, shops care about what products they sell.

I would probably have another table in there as well

[STOREFRONT]
Id int PK,
Name nvarchar(500)

[STOREFRONT_PRODUCTS]
StorefrontId int FK,
ProductId int

[Products]
Id int PK
Name etc..

However if you are talking about creating a product that allows companies without a shop to create an online instance using your software as a service then this is a bit different and your domain concerns are different - what are you trying to do?

Scott
 
Old January 27th, 2011, 09:41 PM
Authorized User
 
Join Date: Dec 2010
Posts: 23
Thanks: 3
Thanked 2 Times in 2 Posts
Default

It's more of a software as a service scenario (e.g. Shopify), so each storefront should have no knowledge of the other storefront's settings, products, catalog, etc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi Sites XTCHost Drupal 2 November 13th, 2011 05:50 PM
comobox contain multi value capri C# 6 April 3rd, 2008 09:05 AM
multi threading [email protected] BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 26th, 2007 11:48 PM
multi-multi-multiple Insert with subquery??? jmjyiannis SQL Server 2000 1 May 5th, 2006 02:20 PM
Multi Parameters jcwc888 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 March 16th, 2006 12:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.