patterns & practices Enterprise Library

Download Report

Transcript patterns & practices Enterprise Library

patterns & practices
Enterprise Library
Brian Button
[email protected]
Consultant/Developer
patterns & 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
Cumulative Downloads - EntLib
Daily Downloads - EntLib
114,17
0
end of 6/21
120000
4500
4000
100000
3000
2500
60000
2000
40000
1500
1000
20000
500
5Ju
n
12
-J
un
19
-J
un
10
-A
pr
17
-A
pr
24
-A
pr
1M
ay
8M
ay
15
-M
ay
22
-M
ay
29
-M
ay
Ap
r
3-
ar
ar
27
-M
ar
20
-M
ar
13
-M
6M
eb
eb
27
-F
eb
20
-F
13
-F
eb
0
6F
an
0
Daily Downloads
80000
30
-J
Cumulative Downloads
3500
Short History
patterns & practices
Patterns
Application
Blocks
Reference
Architectures
Atomic solutions to
recurring problems
Sub-system-level
guidance for common
services
System-level guidance
for common customer
scenarios
Guides
Guidance on architectural principles and cross-cutting
issues such as security and performance
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
Enterprise Library v1 Architecture
Exception
Handling
Caching
Security
Data
Access
Crypto
Config
Tooling
Config
Run-Time
Logging &
Instrumentation
Block Architecture
Block Code
Block
Code
Pluggable
Providers
Block Code
Block
Configuration
Code
Block
Configuration
Design Code
Unit Tests
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 Densmore http://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