data access tech ed india
TRANSCRIPT
![Page 1: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/1.jpg)
![Page 2: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/2.jpg)
Modern Data Access: Patterns & Implementations
Don Smith, Program ManagerMicrosoft patterns & practices
![Page 3: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/3.jpg)
Agenda
The data access layer and your optionsPatterns for keeping entities consistentPatterns for managing entity differencesData access technology assessmentOther data access challengesSummary and questions
![Page 4: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/4.jpg)
Layers & Relationships
ConsiderationsDomain complexityDeveloper experienceGreenfield vs. brownfieldDesired approach: data, code, or model first?Object/schema fidelity
Two OptionsKeep entities consistentManage their differences
Data Access Layer DataStorage
BusinessLogic Layer
BusinessLogicLayer
Data Storage
![Page 5: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/5.jpg)
Keeping Entities Consistent
Recommended when domain is less complexRestricts object-oriented design optionsCan benefit from code generation strategiesMore difficult to evolve over time, but easier to manage
Common patternsRow Data GatewayTable Data GatewayTable ModuleActive RecordRecord Set
We have choicesShape of the objectsHow to combinedata and logic
![Page 6: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/6.jpg)
Pre-Built Types
Record Set (DataSet)Contains the data as rows and columns
Table Data GatewayEncapsulates all SQLCan return record sets
Table ModuleAccepts a record setContains business logic
when objects and schema have a simple relationship
RowsColumns
RecordSet
Find() : RecordSetUpdate(a, b, c)Insert(a, b, c)Delete(id)
TableDataGateway
Process(RecordSet)Calculate(RecordSet)
TableModule
![Page 7: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/7.jpg)
Custom Types
Row Data GatewayRepresents a table’s rowIncludes all CRUD capability
Transaction ScriptContains business logic
Active RecordRepresents a table’s rowContains business logicIncludes all CRUD capability
ID : longFirstName : stringLastName : stringUpdate(first, last)Insert(first, last)Delete(id)
RowDataGateway
ID : longFirstName : stringLastName : stringUpdate(first, last)Insert(first, last)Delete(id)Process()
ActiveRecord
ProcessCostChange()CalculateAdjustment()
TransactionScript
when objects and schema have a simple relationship
![Page 8: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/8.jpg)
Managing Entity Differences
Appropriate for complex domain logicRequires more developer experienceCan leverage more OO (GoF) design patternsAppropriate for apps that evolve over time
Common patternsDomain ModelData MapperRepositoryUnit of WorkSpecification
![Page 9: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/9.jpg)
Storefront Overview
SQLServer
ASP.NETMVC
DataServices
Customer Retailer
Broker
• Manages product information• Maintains
inventory• Processes and
ships orders
IE WPF
Silverlight
• Collects a percentage from each sale• Views sales & site usage reports
• Searches for products• Buys products• Views order
status• Rates products
and retailers
![Page 11: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/11.jpg)
Domain Model & Mapping
Domain ModelAn object model that represents the domainContains the combination of data and business logicTwo basic options
May be robust and leverage OO principlesMay be straightforward in less complex scenarios
May have no knowledge of data access technology
Data MapperRepresents an association of types and properties across the domain model and data modelAlmost always aware of the data access technologyImplementations are often included in O/RM solutionsMapping support varies
![Page 12: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/12.jpg)
Repository
Collection-type interface to data accessMediates between domain model and mapperImplementations are specific to a technology
GetById(id)GetAll()Add(object)Update(object)Delete(id)
Repository
![Page 13: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/13.jpg)
Unit of Work
Maintains a list of new, changed and deleted objects and coordinates persisting changesCan be used across multiple repositories
SubmitChanges()CancelChanges()
UnitOfWork
![Page 14: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/14.jpg)
Specification/Query Object
An object that represents the criteria of a query Allows queries to be easier to manageAvoids the need for a method for each query
Field : stringValue : objectOperator : OpEnum
Specification
![Page 15: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/15.jpg)
Technology Assessment
ADO.NETDataSetDataAdapterDataReader
LINQ to SQLO/RM for simple mappings
ADO.NET Entity FrameworkO/RM for more complex mappings
![Page 16: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/16.jpg)
Related Challenges
Domain Model ResponsibilitiesSerialization (DTOs)Data bindingEdit trackingValidation
Domain Model RepresentationsSubset of the typeView models
![Page 17: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/17.jpg)
Summary
Steps for making choices1. Determine consistency possibilities between the
domain model and the data modelKeep entities consistentManage their differences
2. Choose shape of the typesPre-builtCustom built
3. Determine how to attach the business logicInfluenced by the shape of the types
![Page 18: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/18.jpg)
Resources
Don’s email: [email protected]’s community site: http://dataguidance.codeplex.comPatterns of Enterprise Application Architecturehttp://www.martinfowler.com/eaaCatalogThe Microsoft Patterns & Practices Teamhttp://microsoft.com/practices
![Page 20: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/20.jpg)
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
![Page 23: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/23.jpg)
PowerPoint TemplateSubtitle color
Set the slide title in “title case” and subheads in “sentence case”The subhead color is defined for this template as the fourth font color from the leftFont Size Requirements
Main bullet points must not be smaller than 24ptDo NOT use any font size lower than 20ptSet subhead to 36pt or smaller so it will fit on a single lineTurn off Auto Resizing on all text boxes
![Page 24: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/24.jpg)
PowerPoint Guidelines
Font, size, and color for text have been formatted for you in the Slide MasterUse the color palette shown belowSee next slide for additional guidelinesHyperlink color: www.microsoft.com
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
Sample Fill
![Page 25: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/25.jpg)
Use white text only on these colors
Instructions on Color Readability
Colors are brighter when projected, so contrast and readability are diminished
Sample SampleSample
Sample
Sample
Sample SampleSample
Sample Sample
Use black or dark gray text only on these colors
![Page 26: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/26.jpg)
Slide for Showing Software Code
Use this layout to show software codeThe font is Consolas, a monospace fontThe slide doesn’t use bullets but levels can be indented using the “Increase List Level” icon on the Home menuTo use straight quotes " instead of smart quotes ”, do this:1.Click on the Office Button in the upper left corner2.At the bottom of the menu, choose PowerPoint Options3.From the left pane, select Proofing4.Click on the AutoCorrect Options button5.Select the AutoFormat As You Type tab, and deselect “Straight quotes” with “smart quotes”. Then Click OK.
![Page 27: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/27.jpg)
Table Format
Table TitleColumn 1 Column 2 Column 3 Column 4 Column 5
![Page 28: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/28.jpg)
Bar Chart Example
Category 1 Category 2 Category 3 Category 4
4.3
2.5
3.5
4.5
2.4
4.4
1.8
2.8
2 2
3
5
Chart Title
Series 1 Series 2 Series 3
![Page 29: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/29.jpg)
Pie Chart Example
59%23%
10%9%
Chart Title
1st Qtr2nd Qtr3rd Qtr4th Qtr
![Page 30: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/30.jpg)
धन्यवा�दઆભા�ર ধন্য�বা�দ
ਧੰ�ਨਵਾ�ਦ
ଧନ୍ୟ�ବା�ଦ
நன்றி�
ధన్య�వాదాలు� ಧನ್ಯ�ವಾ�ದಗಳು
നി�ങ്ങള്ക്ക്� നിന്ദി�
![Page 31: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/31.jpg)
Related Content
Breakout Sessions (session codes and titles)
Interactive Theater Sessions (session codes and titles)
Hands-on Labs (session codes and titles)
Hands-on Labs (session codes and titles)
![Page 32: Data Access Tech Ed India](https://reader036.vdocuments.mx/reader036/viewer/2022062702/554a0635b4c905e56c8b5670/html5/thumbnails/32.jpg)
Track Resources
Resource 1
Resource 2
Resource 3
Resource 4