consultant/mentor Microsoft MVP, INETA Speaker, ASPInsider, MCP, VTdotNET Leadercontact twitter theDataFarm.com/blog book web site LearnEntityFramework.com
Database Data Access UI LINQ & some Logic Business Logic
Extensibl eAdaptableTestable Maintainable Sensible!
UI Business/Domain Layer Repository/Unit of Work Infrastructure/Data Access Repository/Unit of Work Infrastructure/Data Access Entity Framework LINQ Tests Database Service Layer
Entity Framework DbContext Customers Sales Orders Products Payments Shipments Shippers Promotions SalesPeople Employees SalaryHistory Returns
Delimits the applicability of a particular model. BOUNDING CONTEXTS gives team members a clear and shared understanding of what has to be consistent and what can develop independently. - Domain Driven Design, Eric Evans 2003
Customer Service Sales Billing Returns Human Resources Shipping Marketing
Customer Service Sales Billing Returns Marketing Human Resources Shipping Customers SalesPeople Shipments Shippers Order Items Customer ShipAddress Customer Order Customer Payments Employee SalaryHistory Order Customer RMA Credit Items Customer Service Customer SalesPerson Addresses ContactHistory Promotion Customers Communications
Customer Service Sales Billing Returns Marketing Human Resources Shipping Customers SalesPeople Shipments Shippers Order ShipAddress Payments Employee SalaryHistory Customer RMA Credit Customer Service Customer SalesPerson Addresses ContactHistory Promotion Communications ItemsToShip Recipient ItemsOrdered Purchaser Invoice Payee ItemReturned Order Contacts “Ubiquitous Language”
“Parent” Entity Related EntityA Related Entity B Related EntityA Related EntityA Aggregate Root
Entity Framework/Queries/Commands Domain Model Persistence Model Payments Invoices Customers DB Mappings, DB concerns, Follow EF rules Domain Model Payments Credit Invoice Payee Payments Credit Invoice Payee Credits
“Encapsulate Redundant Data Access Code”
UI Business/Domain Layer Repository/Unit of Work Infrastructure/Data Access Repository/Unit of Work Infrastructure/Data Access Entity Framework LINQ Tests Database Service Layer
GetOrderById AddOrder RemoveOrder GetAllOrders GetCurrentOrders GetCachedOrders GetOrdersForCustomer Remove GetOrdersForProduct Persist
One repo per type? Read repos? Write repos? One repo per aggregate ? One repo per context?
Customer Repo Order Repo Address Repo Customer Orders Addresses Aggregate Root Order Items
Integration/ Interaction Tests Unit Tests EF Validation, State: No biggie DB: DropCreateDatabaseAlways
Unit of Work Classes UI Tests System.Data.Entity Metadata & DbContexts Fake Context & DataA Fake DbSet Fake Context & Data B ositories Repositories Classes
consultant/mentor Microsoft MVP, INETA Speaker, ASPInsider, MCP, VTdotNET Leadercontact twitter theDataFarm.com/blog book web site LearnEntityFramework.com
TODAY