Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

39

Transcript of Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Page 1: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.
Page 2: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Introducing Enterprise Library 5.0

Tom HollanderSolution ArchitectMicrosoft AustraliaSession Code: ARC302

Page 3: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Session Objectives And Takeaways

Session Objectives: Explain Enterprise Library 5.0 designDemonstrate key improvements

Key Takeaways:User experience matters

We hear your pain!Simplicity for the win!DI Containers everywhere

Better modularity, testability and maintainability

Page 4: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Before the Beginning...

.NET Framework 1.0 is releasedSome written guidance and sample code

Not normally production readyMany organisations invested in their own “frameworks”

2002

Page 5: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Genesis

First patterns & practices Application BlocksData Access Application BlockException Management Application BlockConfiguration Management Application BlockCaching Application BlockEnterprise Instrumentation Framework

Emergence of partner and open source frameworks

ACA.NET, CSLA, ...

2004

Page 6: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library 1.0 / 1.1

Themes:Consistency, Extensibility, Ease of Use, Integration

Target Platform: .NET Framework 1.1Blocks:

Caching, Configuration, Cryptography, Data Access, Exception Handling, Logging & Instrumentation, Security

Tools: Standalone configuration editor

2005

Page 7: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library 2.0

Themes:.NET Framework 2.0 platform alignment

Target Platform: .NET Framework 2.0Blocks:

Caching, Cryptography, Data Access, Exception Handling, Logging, Security

Tools:Standalone configuration editor

2006

Page 8: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library 3.0 / 3.1

Themes:New application blocks, Visual Studio integration

Target Platform: .NET Framework 2.0 & 3.0Blocks:

Caching, Cryptography, Data Access, Exception Handling, Logging, Security, Validation, Policy Injection

Tools:Standalone + VS integrated configuration editor, Application Block Software Factory

2007

Page 9: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library 4.0 / 4.1

Themes:Dependency Injection, WMI 2.0

Target Platform: .NET Framework 3.5Blocks:

Caching, Cryptography, Data Access, Exception Handling, Logging, Security, Validation, Policy Injection, Unity

Tools:Standalone + VS integrated configuration editor

2008

Page 10: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library 5.0: Themes

Enhanced User Experience,Simplicity for the Win!Learnability & Discoverability

Accelerate Your Development!

Page 11: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Functional blocks Infrastructure

Structural/wiring blocks

Security

Data Access

Cryptography

Validation

Logging

Caching ExceptionHandling

Unity

Config Instrumen-tation

PolicyInjection

Enterprise Library 5.0: Blocks

Page 12: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

AlignmentTarget binaries for .NET Framework 3.5 SP1

Target source projects for VS2008Target config tool for both VS2008 and VS2010

Page 13: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

We hear your pain!

Page 14: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

When Something Goes Wrong

Debugging

Useful info is buried deep inside the stackNot just Unity, but entire EntLib

Page 15: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Improved error messaging demo

Page 16: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Object Graph

DriveController

EngineMonitor

EngineDataRepository EngineSensor

ILogger

ConsoleLogger

AuthorizationProvider

IAuthorizationToken

DefaultAuthorizationToken

P

P

Page 17: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Logging Performance

Originally, planned to implement async loggingPerf analysis of the lower level operations of the logging block (v4.1) showed:

The formatter took 54% of the total timeOf this, the most expensive operations are:

11.76 Getting the machine name9.63 Computing Severity textual representation5.70 Undetermined mscorwks.dll work5.17 Computing DateTime textual representation4.46 StringBuilder.Append4.10 Getting the process name

Page 18: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Logging Performance Optimisation

Added predefined timestamp patterns mapped to high-speed formatting implementations.

FixedFormatISOInternationalDate: yyyy-MM-ddFixedFormatTime: HH:mm:ss.fff

Added 4 new "local" tokens for context info localAppDomainlocalMachinelocalProcessNamelocalProcessId

Modified default template to take advantage the above

Page 19: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Logging Performance Optimisation Preliminary Results

Formatter responsible for ~50% of the execution timeImprovements

45% local improvement

53% local improvement

N=1M

Page 20: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Processing Results from Sprocs

Data Access Application Block traditionally made it easier to call sprocsProcessing the results still means dropping back into classic ADO.NET code

Issue: how could we make it easier to consume the results of a sproc?

Page 21: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

DAAB Accessorsdemo

Page 22: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

LINQ Style Result Processing

Basic idea:Instead of a DataReader from a query, get back an IEnumerable<T>Now we can do LINQ to Objects

Introduced AccessorsProvide a higher level abstraction that combines input mapping, output mapping, and result set management into a single object.Accessors are easily injectable

Page 23: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Config Experience

Programmatic config supportIntellisense in XML editorDefault config out of the boxImproved config tool

Page 24: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Fluent Configuration Interface

Motivation:Customers requested a better way to configure EntLib programmaticallyMake our own test cases more readable

Fluent interfaceMore succinct, more readable programmatic configuration

Ref: Martin Fowler, Eric Evans. http://martinfowler.com/bliki/FluentInterface.html

Page 25: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Fluent Interfacesdemo

Page 26: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Tackling External Complexity

Single entry pointEnterpriseLibraryContainer.Current

Supporting testability in your code that uses EntLib

Using DI style with instancesContainer independence

Not tied to UnityCan build your own adapters

Preliminary perf is equivalent to v4.1 or betterImportantly: All existing user code still works

Page 27: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Tackling Internal Complexity

Cleanupgot rid of ~200 classes!removed layers of indirectionadded ~120 classes, but less complicatedreduced # assemblies (incl. OB2 – RIP!!!!!)

Changed internals significantlycustom blocks would need to be re-writtenbut this should be easier now

Page 28: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Getting EntLib objectsdemo

Page 29: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Config Tool: UX Matters!

Config tool has not evolved significantly since v1New and occasional users fared poorly in usability studiesIs it time for a paradigm shift?

Important :The following mock-ups are experimental and may never see the light of dayBut improving config UX is a core goal of v5

Page 30: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Config Tool Ux

Page 31: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.
Page 32: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.
Page 33: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Learnability

Hands-On LabsNew Guides

Your feedback is invitedentlib.codeplex.com

Page 34: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

But Wait... There’s More!

HighlightsDAAB Async overloadsUnity config tool supportUnity/MEF integrationValidation WPF integrationPurge old rolling log filesMultiple config file support

Full product backlog on http://entlib.codeplex.com

Page 35: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Key Takeaways

Improving user experienceSimpler, more consistent code baseSimpler to useBetter support for DI-style of developmentExisting public API not broken

Page 36: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

www.microsoft.com/teched

Sessions On-Demand & Community

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources

Page 37: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

Enterprise Library Resources All EntLib5 current bits:

entlib.codeplex.comunity.codeplex.com

Released Enterprise Library and related resources:msdn.microsoft.com/practicesmsdn.microsoft.com/entlib

Enterprise Library Community:entlib.codeplex.com

Blogs:Tom Hollander: blogs.msdn.com/tomhollGrigori Melnik: blogs.msdn.com/agileBob Brumfield: blogs.msdn.com/bobbrumChris Tavares: tavaresstudios.com/Blog

Page 38: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

COMPLETE YOUR EVALUATION FORMS IN COMMNET AND BE IN TO WIN ONE OF THE 150 DAILY PRIZES*

GIVE US YOUR FEEDBACK & WIN INSTANTLY!

*For full terms & conditions and more information, please visit the CommNet Portal.

Page 39: Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302.

© 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.