Tom Hollander Solution Architect Solutions Development Centre Microsoft Australia ARC307
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
Application Blocks are reusable, extensible source-code components that provide guidance for common development challenges Enterprise Library is a collection of general purpose application blocks Caching, Configuration, Cryptography, Data Access, Exception Handling, Logging, Security Emphasis on Consistency, Extensibility, Ease of Use and Integration
Address top feedback received for existing application blocks Provide new application blocks to support additional development challenges Support integration with relevant features of.NET Framework 3.0 Improve the experience around key development activities Simplify the development of new application blocks and extensions Retain compatibility with Enterprise Library 2.0
New application blocks Validation Application Block Policy Injection Application Block Improvements to existing application blocks Data Access Application Block Logging Application Block WCF Integration Logging, Exception Handling and Validation Application Blocks Configuration improvements Visual Studio-integrated configuration tool Environmental Overrides Manageable Configuration Source Automation Application Block Software Factory Strong Naming Guidance Package
CachingCaching SecuritySecurity DataAccessDataAccessLoggingLogging ExceptionHandlingExceptionHandling Plug-in ConfigHelpers & Design ConfigHelpers Instrumen- tation Object Builder CryptographyCryptography Core Policy Injection ValidationValidation
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
Specify your validation rules once In configuration Using attributes Programmatically Easily validate data from anywhere in your application Programmatically Integrated into Windows Forms, ASP.NET or WCF Composable validation logic Built-in library of common primitive validation rules Combine validation rules on type members and using Boolean logic Apply multiple validation rule sets to the same types
Validation Application Block includes the following rules: Not Null (value must not be null) Contains Characters (e.g. does not contain any of /\?<>”:) Regular Expression (e.g. value is a valid address) Range (e.g. must be from or 1/1/1950 to 12/31/1999) Relative DateTime (e.g. birth date is more than 18 years ago) String Length (e.g. string is at least 8 characters long) Domain (e.g. must be one of {John, Paul, George, Ringo}) Enum Conversion (e.g. string can be converted to a value in the Color enum type) Type Conversion (e.g. string can be converted to a DateTime) Property Comparison (e.g. MaxDate > MinDate) All validation rules can be negated E.g String Length must not be between 5 and 10 characters
Attributes Attributes allow you to specify validation rules directly within the type being validated Validation logic cannot be changed without recompiling You must own the source code of the type Configuration Validation rules are stored in XML and can be edited with the Enterprise Library configuration tool Validation logic can be changed without recompiling You don’t need to own the source code of the type
Programmatically Using the block’s core API Via Integration Adapters Windows Forms and ASP.NET Integrated into user input controls Windows Communication Foundation Integrated into service interface
Separate cross-cutting concerns from business logic Use interception and injection to apply policies at runtime Define policies using configuration or attributes Leverage other application blocks to implement common cross-cutting concerns Validation, Logging, Authorization, Exception Handling, Caching, Performance Counters Provide flexibility in interception mechanisms
ClientClientMyObjectMyObject ProxyProxy Validation Application Block ASP.NET Cache Logging Application Block Validation Handler Caching Handler Logging Handler MyObject obj = PolicyInjection.Create (); int result = obj.DoStuff(123); ExceptionException ValidationFailedValidationFailed Found In Cache result == 42
Policies defined in configuration consist of a set of matching rules and the definition of the handler pipeline Matching rules are predicates that specify which members the policy should apply to Handlers can also be applied directly to types and members using attributes
Validation Handler Logging Handler Authorisation Handler Exception Handling Handler Caching Handler Performance Counter Handler
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
SQL Server Compact Edition provider New SqlCeDatabase class that integrates with the SQL CE managed provider TransactionScope integration Prevents escalation to DTC when multiple updates are made to the same database within a TransactionScope context Batch updates UpdateDataset now supports an updateBatchsize parameter
Rolling Flat File Trace Listener Automatically creates a new file based on file size or date/time Improved Text Formatter Reflected Property Token, to retrieve data out of custom LogEntry types Display timestamps in local or UTC time WCF Integration EntLibProxyTraceListener and XmlTraceListener
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
Edit configuration from within the IDE Launched from.config files in the Solution Explorer Can be configured to point to different sets of assemblies
Simplifies management of configuration files across multiple environments Separates master configuration files from environment-specific delta files Specify which settings to override on a node-by-node basis Merge configuration files using the configuration tool or a command-line tool
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
Streamlines building your own application blocks and extensions to existing application blocks Features include: Code generation in either C# or Visual Basic.NET Solution templates for Application Blocks and Provider Libraries Recipes to create custom providers for Enterprise Library application blocks Recipes to create new factories, provider bases and providers for your own blocks Recipes to create design-time configuration code from runtime configuration classes
Introduction New Application Blocks Validation Application Block Policy Injection Application Block Improvements to Existing Application Blocks Configuration Improvements Application Block Software Factory finally {
EntLib 3.0/3.1 are 100% API compatible with the previous January 2006 release of Enterprise Library Configuration formats for existing blocks are unchanged, but assembly version numbers and possibly public key tokens will need to be changed 2.0 and 3.x can be installed side-by-side (but not 3.0 and 3.1) Supports.NET Framework 2.0 or 3.0 WCF-specific functionality requires.NET Framework 3.0
Download Enterprise Library and related resources from: Join the Enterprise Library Community at: Download or contribute to community extensions at Read blogs from the Enterprise Library team at:
A fully equipped project delivery environment hosted within Microsoft Australia A specialist engineering facility for delivering high quality software quickly A way of tapping into external skills and resources while using your own team The SDC is a unique way to reduce project risk, get the job done and pick up skills or
© 2007 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.