Tom Hollander Solution Architect Microsoft Australia Session Code: ARC302

Preview:

Citation preview

Introducing Enterprise Library 5.0

Tom HollanderSolution ArchitectMicrosoft AustraliaSession 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

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

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

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

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

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

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

Enterprise Library 5.0: Themes

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

Accelerate Your Development!

Functional blocks Infrastructure

Structural/wiring blocks

Security

Data Access

Cryptography

Validation

Logging

Caching ExceptionHandling

Unity

Config Instrumen-tation

PolicyInjection

Enterprise Library 5.0: Blocks

AlignmentTarget binaries for .NET Framework 3.5 SP1

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

We hear your pain!

When Something Goes Wrong

Debugging

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

Improved error messaging demo

Object Graph

DriveController

EngineMonitor

EngineDataRepository EngineSensor

ILogger

ConsoleLogger

AuthorizationProvider

IAuthorizationToken

DefaultAuthorizationToken

P

P

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

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

Logging Performance Optimisation Preliminary Results

Formatter responsible for ~50% of the execution timeImprovements

45% local improvement

53% local improvement

N=1M

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?

DAAB Accessorsdemo

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

Config Experience

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

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

Fluent Interfacesdemo

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

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

Getting EntLib objectsdemo

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

Config Tool Ux

Learnability

Hands-On LabsNew Guides

Your feedback is invitedentlib.codeplex.com

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

Key Takeaways

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

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

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

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.

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

Recommended