40
Lean Enterprise Architecture By Shahed Chowdhuri, Sahil Talwar, Doguhan Uluca A lean, testable enterprise architecture with a modern client stack

Lean Enterprise Architecture

Embed Size (px)

DESCRIPTION

This presentation by Excella Consulting's Shahed Chowdhuri and Sahil Talwar covers EF Code First Migrations and Lean Enterprise Architecture Design. Including: - How we use EF Code First Migrations to keep our developers' databases in sync, automatically deploy updates using TeamCity and work with DB Architects who utilize tools like ER/Studio. - Real world examples to explain how to combat over engineering in an enterprise application through lean startup principles.

Citation preview

Page 1: Lean Enterprise Architecture

Lean Enterprise Architecture

By Shahed Chowdhuri, Sahil Talwar, Doguhan Uluca

A lean, testable enterprise architecture with a modern client stack

Page 2: Lean Enterprise Architecture

Thanks to our Sponsorsfor keeping the fires lit

Page 3: Lean Enterprise Architecture

TDD (Test Driven Development)

BDD (Behavior Driven Development)

CI (Continuous Integration)

CD (Continuous Delivery)

Introduction

ASP.NETMVC

DB

EnterpriseWebApplication

Looking for Ways to Improve & Modernize

Motivation behind this design?

Our desire to do the following:

Page 4: Lean Enterprise Architecture

Data Access Layer ShahedChowdhuriUsing Code-First Migrations

Page 5: Lean Enterprise Architecture

Tech Check

ASP.NETMVC

EntityFramework

EF Code-First

Development

EF Code-First Migrations

Are you familiar with…?

Page 6: Lean Enterprise Architecture

Options and Alternatives

Database-First

(EDMX)

Model-First(Visual

Designer)

Code-First (automatic migrations)

Code-First (manual

migrations)

Page 7: Lean Enterprise Architecture

What are we trying to solve?

Page 8: Lean Enterprise Architecture

DAL: Agenda

1. Models & Mapping

2. Connection Strings

3. Enable Migrations

4. Update Database

5. Push Code + Migrate Server DB

6. Process Workflow

Page 9: Lean Enterprise Architecture

1. Models & MappingDBContext.OnModelCreating()

Page 10: Lean Enterprise Architecture

2. Connection Strings

Page 11: Lean Enterprise Architecture

3. Enable Migrations

Page 12: Lean Enterprise Architecture

migration code

4. Update Database

model code

migration code + seed

devDB

(sql)

Page 13: Lean Enterprise Architecture

5. Push Code + Migrate Server DBcode push code

CI

code pull code

migrate.exeServer

DB

Page 14: Lean Enterprise Architecture

6. Process Workflow

dev team DB architects

communication

DB

Page 15: Lean Enterprise Architecture

Code Walkthrough

Page 16: Lean Enterprise Architecture

DAL: Conclusion

Code-First Migrations

Dev Team Synchronized

Server DeploymentDatabase

Versioning

Continuous Development

Page 17: Lean Enterprise Architecture

Resources

• EF Code First Migrations on MSDN:– http://msdn.microsoft.com/en-US/data/jj591621

• Web.config & configSource:– http://wakeupandcode.com/all-your-database-are-belong-to-us/

• PluralSight EF Migrations video tutorial:– http://pluralsight.com/training/Courses/TableOfContents/efmigrations

Page 18: Lean Enterprise Architecture

The Domain Sahil TalwarSimpler is better

Page 19: Lean Enterprise Architecture
Page 20: Lean Enterprise Architecture
Page 21: Lean Enterprise Architecture
Page 22: Lean Enterprise Architecture

Versus…

Page 23: Lean Enterprise Architecture

Heavyweight

Enterprise Architecture

Page 24: Lean Enterprise Architecture

1Round

Page 25: Lean Enterprise Architecture

Best PracticesRepositories

Unit of Work

Entity Framework

Page 26: Lean Enterprise Architecture

DomainIUnitOfWork

IRepository IRepository IRepository

DalDbContext

DbSet DbSet DbSet

Web Api

Page 27: Lean Enterprise Architecture
Page 28: Lean Enterprise Architecture

2Round

Page 29: Lean Enterprise Architecture

Web Models

Domain Models

Dal Models

Api Models

Page 30: Lean Enterprise Architecture
Page 31: Lean Enterprise Architecture

Web

Domain

Dal

Core(Models)

…Except Api-Domain.

Page 32: Lean Enterprise Architecture

3Round

Page 33: Lean Enterprise Architecture

Student Context

Universities

Departments

Professors Classes

Advisors

Students

Context Per Complex Object

UniversityContext

Page 34: Lean Enterprise Architecture

Professors Classes Students

Departments Advisors Universities

Single Responsibility: Context Per Object

Universities

Departments

Professors Classes

Advisors

Students

Page 35: Lean Enterprise Architecture

ServiceStoreServiceStore

Service Service Service

Shared Context

Service Service Service

Page 36: Lean Enterprise Architecture

Solid gold.

Page 37: Lean Enterprise Architecture

Services

Domain 1

Web Api

Domain 2 Domain 4 Domain 5

Dal Models

Domain 3 Domain 6

Page 38: Lean Enterprise Architecture
Page 39: Lean Enterprise Architecture
Page 40: Lean Enterprise Architecture

Image Credits• http://i-cdn.apartmenttherapy.com/uimages/kitchen/2010_05_17-Lasagna.jpg• http://www.callagold.com/wp-content/uploads/2012/02/gold-plated-porsche-1.jpg• http://img.diytrade.com/cdimg/1057186/11295732/0/1259756915/Gold_Plating_System.jpg• http://www.artisticplating.net/images/gold4.jpg• http://epf.thingml.org/wikis/inf5120/practice.mgmt.scrum.base-sintef/guidances/roadmaps/resources/Scru

mLargeLabelled.png• http://1.bp.blogspot.com/-H0OeuWi6oXc/UG9BbClJF-I/AAAAAAAAAqY/6v4hZ5zGGXk/s1600/DDD_TDD_BDD

_intersection.png• http://blogs.jetbrains.com/teamcity/wp-content/uploads/2008/09/teamcity512.png• http://www.regretfreelife.net/wp-content/uploads/2012/09/lscycle.jpg• http://automapper.org/img/black_logo.png• http://4.bp.blogspot.com/-1p7GSp6m_a8/UOrbvzLfwKI/AAAAAAAAAI4/oYULEv-jJWc/s1600/g3211.png• http://www.clker.com/cliparts/T/G/C/H/K/W/no-sign-hi.png• http://2.bp.blogspot.com/---z3-XY_a5M/T2uGslh4fYI/AAAAAAAAADY/PyqTk88n3Qo/s1600/Health+Services+

Enterprise+Architecture+v5.3+(3-20-12).jpg• http://fc06.deviantart.net/fs71/f/2012/119/e/7/sumo_wrestler_by_maxxparis-d4xytyj.jpg• http://www.nerdpad.com/wp-content/uploads/2010/04/vs2010_full.jpg• https://secure.gravatar.com/avatar/cf4c53b37956b009d609caeacb171c40?s=420&d=https://a248.e.akamai.n

et/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png• http://nblumhardt.com/wp-content/uploads/2009/12/Autofac-2-Sketch1.png