dev link2009 multi tenancy beyond the whiteboard chris hefley
Post on 21-Nov-2014
3.451 Views
Preview:
DESCRIPTION
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