dev link2009 multi tenancy beyond the whiteboard chris hefley

Post on 21-Nov-2014

3.451 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Multi-Tenancy: Beyond the Whiteboard. Presentation from Devlink 2009, Nashville, TN, Chris Hefley http://indomitablehef.com See sample project at http://code.google.com/p/sokmunkae/

TRANSCRIPT

Multi-Tenancy: Beyond the Whiteboard

Chris Hefley, Bandit Software

Blog: http://indomitablehef.comEmail: indomitablehef@gmail.com

Twitter: @indomitablehef

Multi-Tenancy

The Big Decision• Database Per Tenant• Schema Per Tenant• Tenant Id per Row• Tenant as Aggregate Root

Other Considerations• The Url– app.com (salesforce.com)– tenant.app.com (me.basecamphq.com)– app.com/tenant (facebook.com/me)– tenant.com (mynewyahoostore.com)

• Data access– ORM– Dynamic SQL– Stored Procedures

Design Goals

•Agnostic•Secure•Maintainable

Design Patterns: Repository

Data Access Layerdao.RetrieveOne(Dictionary<string,object> parameters)dao.Delete(person.Id) dao.SaveOrUpdate(Person p)dao.RetrieveAll( Dictionary<string,object> parameters)

Domain Modelpublic class Person {…}

Repository (PersonRepository)repository.Find(PersonQuery q) {…return Person}repository.Remove(Person p) {}respostory.Add(new Person {…})repository.ListByProject(Project p) {…return List<Person>}

Repository as BoundaryYour Application “Knows Nothing”

RepositoryEffectively adds:

“WHERE TenantId =“To every set of

criteria passed on to the data layer

Design Patterns: DI/IOC

Inversion of Control

Inversion of Control

First Benefit: Testing

But wait, there’s more!

Sok Munkae Data Model

Organization

User Project

Task

top related