Upload
chris-hefley
View
3.451
Download
1
Embed Size (px)
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/
Citation preview
Multi-Tenancy: Beyond the Whiteboard
Chris Hefley, Bandit Software
Blog: http://indomitablehef.comEmail: [email protected]
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