Building End-to-End Multi-Client Service Oriented Applications Module 03 Architecture & Database of the Car Rental System
Database Account Car Reservation AccountId CarId ReservationId • • • LoginEmail Description AccountId • • • FirstName Color CarId • • • LastName Year RentalDate • • • Address RentalPrice ReturnDate • • • Any table whose records are City • account-specific, includes State • ZipCode AccountId. • Rental CreditCard • (no multi-joins to get to ExpDate • RentalId Account) • AccountId • CarId • webpages_* Will explain further in “Entities” DateRented • DateReturned • webpages_Membership DateDue • • webpages_OAuthMembership • webpages_Roles • webpages_UsersInRoles •
Core Use Cases As a customer Reserve an available car for a given set of dates Cancel an existing reservation View rental history As a Car Rental employee Manage inventory of cars Rent a reserved car to a customer Accept a returned car from a customer View customer and rental history list
Service Decomposition Inv nvent ntory Rental al Acco ccount Vehicle CRUD Vehicle reserve Customer list • • • Vehicle availability Reservation cancel Account update • • • Vehicle rental View account info • • Rental return • Current rentals • Dead reservations • Ser ervices c can hit n hit bus business engi engine ne f for beha r behavior r reus eusability or r da data r repo epository f for r stra raight da data I I/O
Security Forms Authentication Deskt ktop Web b Site • Secures site & API • We Web API WCF CF Service ices Windows Authentication • Dedicated App User • Dedicated Admin Role • Validate Authorization by user: Site user to be passed in every service call and account compared to data being retrieved. • Ex: User1 may be authenticated but should not be able to retrieve data for User2 • Web API calls also use similar facility •
Car Rental System Architecture ASP.N .NET T MVC MVC Clie ient ASP.N .NET T MVC MVC Kno nockout ut C Client nt WP WPF Desktop C Client ASP.N .NET W T Web API REST S T Serv rvices Clie ient-si side Ge Gene neral P Purp urpose Entit itie ies Servic ice WCF WC Other D Dat ata a Service C Contr tracts ts Factorie ies Proxie ies Contra racts * * Core re F Fra ramework rk cli lient s sid ide server s side MEF D DI Contain ainer WC WCF Se Service H Host Servic ice Bus usine ness Other D Dat ata a WC WCF Se Services Busi siness S ss Service L Layer Contra racts Engine nes * * Contra racts * * Server er-side de Entit itie ies Dat ata R a Repository Dat ata R a Repositories Misc. D . DTO TOs Dat Data Ac Access L Lay ayer Factory ry Database L Dat Lay ayer SQL Se SQ Server D DB
Car Rental System Architecture Flatter model Testable Code (services and down-layers (all code layers developed ASP.N .NET T MVC MVC Clie ient ASP.N .NET T MVC MVC Kno nockout ut C Client nt WP WPF Desktop C Client don’t call for deep, totally with testability in concerns encapsulated business objects) in forefront) ASP.N .NET W T Web API REST S T Serv rvices Strict Line of Use of DI Clie ient-si side Gene Ge neral P Purp urpose Entit itie ies Separation Throughout Servic ice WC WCF Other D Dat ata a Service C Contr tracts ts Factorie ies Proxie ies Contra racts * * (clients will ONLY communicate (both business-side & client-side Core re F Fra ramework rk With services and have no will benefit from cli lient s sid ide knowledge of anything else) dependency injection) business s side MEF D DI Contain ainer Lack of WCF Se WC Service H Host Pass-Through Servic ice Bus usine ness Other D Dat ata a (no unnecessary objects just for WC WCF Se Services Busi siness S ss Service L Layer Contra racts Engine nes * * Contra racts * * data-passing purposes) Server er-side de Entit itie ies Dat ata R a Repository Dat ata R a Repositories Misc. D . DTO TOs Dat Data Ac Access L Lay ayer Muti-Use Factory ry Entities (entities on each side used Database L Dat Lay ayer SQL Se SQ Server D DB for multiple purposes – see ‘lack of pass-through’)
End of module LET’S GET TO SOME SERIOUS CODING !
Recommend
More recommend