patterns & practicesEnterprise Library
Brian [email protected]/Developerpatterns & practices
Speaker Introduction
Principal Consultant at Agile Solutions Group
• St. Louis-based
• Train, mentor, develop, lead teams in agile software development
Consulted in Microsoft patterns & practices since October, 2003
• Smart Client Offline Application Block
• Enterprise Library
My badge is orange, not blue
• These opinions are mine and mine alone
• I do not speak for MS or patterns & practices
Welcome to an Exclusive Club!Enterprise Library Downloads
0
20000
40000
60000
80000
100000
120000
Cu
mu
lati
ve D
ow
nlo
ad
s
0
500
1000
1500
2000
2500
3000
3500
4000
4500
Daily D
ow
nlo
ad
s
Cumulative Downloads - EntLib Daily Downloads - EntLib114,170end of 6/21
Short History
patterns & practices
Reference Reference ArchitecturesArchitectures
ApplicationApplicationBlocks Blocks
Guidance on architectural principles and cross-cutting Guidance on architectural principles and cross-cutting issues such as security and performance issues such as security and performance
PatternsPatterns
Atomic solutions to Atomic solutions to recurring problemsrecurring problems
Sub-system-level Sub-system-level guidance for common guidance for common
servicesservices
System-level guidance System-level guidance for common customer for common customer
scenariosscenarios
GuidesGuides
Application Blocks defined
Reusable, extensible, modifiable
• Common mechanism
Logging
Caching
Configuration management…
• Reusable fragment of app architecture
User interface process management
Smart disconnected client
Service aggregation…
Application Blocks are great, but…
In general feedback has been extremely positive, but there is room for improvement:
• Make blocks consistent
• Make blocks work well together
• Minimize dependencies
On other blocks
On infrastructure
• Make it easier to configure blocks
• Make evaluation and understanding of blocks easier
• Make using blocks easier
Introducing “Enterprise Library”
Library of reusable software assets to address common enterprise development challenges
Part of the patterns & practices guidance library
Strong focus on consistency, extensibility, ease of use and integration
v1 produced in partnership with Avanade, leveraging experience from customer engagements and incorporating aspects of their ACA.NET application framework
Included Application Blocks
Caching
Data
Exception Handling
Logging
Security
Cryptography (symmetric only)
Common configuration and tooling
Let’s build an example app
Simple data access to Northwind
Add a bit of logging
And some exception handling
SecuritySecurity
CryptoCrypto
ConfigConfigRun-TimeRun-Time
ConfigConfigToolingTooling
Data Data AccessAccess
Logging & Logging & InstrumentationInstrumentation
CachingCachingExceptionExceptionHandlingHandling
Enterprise Library v1 Architecture
Block Architecture
Block CodeBlock Code Block CodeBlock CodeBlock CodeBlock CodePluggable Pluggable
ProvidersProviders
BlockBlockConfiguration Configuration
CodeCode
Unit TestsUnit Tests
Block Block ConfigurationConfigurationDesign CodeDesign Code
What comes in the box?
There is no box
Released as guidance
• Source code format only
• “As-is”, like rest of p&p guidance
You get
• All source
• All unit tests
• Documentation
• Quick starts
Caching Application Block
Provides a flexible and extensible caching mechanism that can be used at all layers of an application
Supports backing stores that persist cache data into a database or isolated storage, so the data can survive app restarts
Can be used in ASP.NET apps, although the ASP.NET cache is preferred for simple scenarios
Supports similar scenarios to the original caching block, but with a revised architecture to make it more thread- and exception-safe
Data Access Application Block
Provides simplified access to the most common data access operations
Aim was to keep much of the simplicity of the original DAAB blocks, but to provide additional features requested by customers
Notable new features:
• Support for multiple database types through a factory (SQL Server, Oracle and DB2 out of the box). This provides consistent and portable code (caveats apply!)
• Connection strings are stored and managed in external configuration
Exception Handling Application Block
Facilitates consistent exception handling behavior at logical boundaries of an application
Allows the creation of “exception policies” which dictate which actions should be taken for specific exception types at the logical boundary
• Example: All security exceptions arising from the business layer need to be logged, and the messages sanitized before being propagated to the caller
Actions are extensible; we provide Logging, Wrapping one exception with another, and Replacing one exception with an other
Block has little in common with the existing EMAB which was primarily used to log exceptions
Logging & Instrumentation Application Block
Allows applications to log business and operations data to various destinations, which are externally configurable
Replaces the Enterprise Instrumentation Framework and the existing Logging Application Block
Configuration specifies which messages go where, and how they are formatted
Formatters and sinks are extensible. We provide sinks for Event Log, Database, Text File, MSMQ, E-mail, WMI and Windows Event Tracing
Security Application Block
Provides a simple API and pluggable implementations of core security primitive operations
Covers 5 security areas: Authentication, Authorization, Roles, Profile and Security Caching
Each module supports extensible plug-in providers. In general we supply plug-ins for common Microsoft infrastructure (AD, AzMan) as well as a light-weight database implementation
Developers can build their own plug-ins to interface with existing security solutions
Cryptography Application Block
Provides a simplified approach to implementing common cryptography scenarios
Includes modules for symmetric cryptography and hashing
Each module supports pluggable algorithms and key stores
• Supports all .NET crypto algorithms out of the box, or developers can implement their own
Algorithms and keys can be managed through the configuration tool
Configuration Application Block
Allows applications to easily read and write configuration data from configurable storage locations
Used by all blocks in Enterprise Library, can also be used by customer blocks, frameworks and applications
Includes two parts:
• Configuration Runtime, which applications use at runtime to access configuration data
• Configuration Designtime, which provides nodes that are used by the configuration tool to give a simple design-time experience
Configuration can be encrypted and individual elements can be masked in the tool
Lots of places to go learn more…
Webcasts
• Several overview webcasts plus one webcast per block
• http://www.pnplive.com
Hands on Labs
• Labs focused on learning to use each block
• http://www.pnplive.com/hands_on_labs.htm
Podcasts
• Listen to the Enterprise Library developers talk about the culture, experiences, and history of EL V1.
• http://www.ronjacobs.com/podcast/default.htm
Even more places…
Patterns & Practices
• Download and install Enterprise Library
• http://msdn.microsoft.com/practices
Enterprise Library GotDotNet Workspace
• http://practices.gotdotnet.com/projects/entlib
Learn from the authors
Enterprise Library team blogs:
• Brian Button http://oneagilecoder.agilestl.com
• Scott Densmorehttp://blogs.msdn.com/scottdensmore
• Peter Provost http://peterprovost.org
• Jim Newkirk http://blogs.msdn.com/jamesnewkirk
• Tom Hollander http://blogs.msdn.com/tomholl
• Hisham Baz http://blog.hishambaz.com
• Tim Shakarian http://dotnetjunkies/WebLog/tshak
What’s coming?
Enterprise Library June 2005
• Bug fixes, a few new features, changes to compile on Whidbey
• June 30, 2005 or so
Enterprise Library for .NET 2.0
• Same feature set implemented on Whidbey
• A little while after Whidbey ships
Enterprise Library V?.?
• Solving the next batch of problems
• A year or more after Whidbey ships