Tom Hollander Solution Architect Solutions Development Centre Microsoft Australia ARC307.
-
date post
21-Dec-2015 -
Category
Documents
-
view
215 -
download
1
Transcript of Tom Hollander Solution Architect Solutions Development Centre Microsoft Australia ARC307.
Enterprise Library 3.1Tom HollanderSolution ArchitectSolutions Development CentreMicrosoft Australia
ARC307
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
The Story So Far…
Application Blocks are reusable, extensible source-code components that provide guidance for common development challengesEnterprise Library is a collection of general purpose application blocks
Caching, Configuration, Cryptography, Data Access, Exception Handling, Logging, SecurityEmphasis on Consistency, Extensibility, Ease of Use and Integration
Goals of Enterprise Library 3.x
Address top feedback received for existing application blocksProvide new application blocks to support additional development challengesSupport integration with relevant features of .NET Framework 3.0Improve the experience around key development activitiesSimplify the development of new application blocks and extensionsRetain compatibility with Enterprise Library 2.0
Enterprise Library 3.x – New Features At a Glance
New application blocksValidation Application BlockPolicy Injection Application Block
Improvements to existing application blocks
Data Access Application BlockLogging Application Block
WCF IntegrationLogging, Exception Handling and Validation Application Blocks
Configuration improvements
Visual Studio-integrated configuration toolEnvironmental Overrides Manageable Configuration Source
AutomationApplication Block Software FactoryStrong Naming Guidance Package
Enterprise Library 3.xApplication Blocks
Caching
Security
Data Access
Logging
ExceptionHandling
Plug-inConfig
Helpers & Design
Instrumen-tation
ObjectBuilder
Cryptography
Core
Policy InjectionValidation
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
Validation Application Block Goals
Specify your validation rules onceIn configurationUsing attributesProgrammatically
Easily validate data from anywhere in your application
ProgrammaticallyIntegrated into Windows Forms, ASP.NET or WCF
Composable validation logicBuilt-in library of common primitive validation rulesCombine validation rules on type members and using Boolean logicApply multiple validation rule sets to the same types
Supplied Validation Rules
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 e-mail address)
Range (e.g. must be from 10-20 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
Specifying Validation Rules
AttributesAttributes allow you to specify validation rules directly within the type being validatedValidation logic cannot be changed without recompilingYou must own the source code of the type
ConfigurationValidation rules are stored in XML and can be edited with the Enterprise Library configuration toolValidation logic can be changed without recompilingYou don’t need to own the source code of the type
Validating Data
ProgrammaticallyUsing the block’s core API
Via Integration AdaptersWindows Forms and ASP.NET
Integrated into user input controls
Windows Communication FoundationIntegrated into service interface
Validation Application Block
demo
Policy Injection Application Block Goals
Separate cross-cutting concerns from business logic
Use interception and injection to apply policies at runtimeDefine 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
Policy Injection Application Block
Client MyObjectProxy
Validation Applicatio
n Block
ASP.NET Cache
Logging Application Block
Valid
atio
n
Handle
r
Cach
ing
Handle
r
Loggin
g
Handle
r
MyObject obj = PolicyInjection.Create<MyObject>();int result = obj.DoStuff(123);
Exception
Validation
Failed
Found In Cache
result == 42
Defining Policies
Policies defined in configuration consist of a set of matching rules and the definition of the handler pipelineMatching rules are predicates that specify which members the policy should apply toHandlers can also be applied directly to types and members using attributes
Policy Injection Application Block
demo
Supplied Handlers
Validation HandlerLogging HandlerAuthorisation HandlerException Handling HandlerCaching HandlerPerformance Counter Handler
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
Data Access Application Block
SQL Server Compact Edition providerNew SqlCeDatabase class that integrates with the SQL CE managed provider
TransactionScope integrationPrevents escalation to DTC when multiple updates are made to the same database within a TransactionScope context
Batch updatesUpdateDataset now supports an updateBatchsize parameter
Logging Application Block
Rolling Flat File Trace ListenerAutomatically creates a new file based on file size or date/time
Improved Text FormatterReflected Property Token, to retrieve data out of custom LogEntry typesDisplay timestamps in local or UTC time
WCF IntegrationEntLibProxyTraceListener and XmlTraceListener
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
Visual Studio-integrated Configuration Tool
Edit configuration from within the IDELaunched from .config files in the Solution ExplorerCan be configured to point to different sets of assemblies
Environmental Overrides
Simplifies management of configuration files across multiple environmentsSeparates master configuration files from environment-specific delta filesSpecify which settings to override on a node-by-node basisMerge configuration files using the configuration tool or a command-line tool
Configuration Tool
demo
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
Application Block Software Factory
Streamlines building your own application blocks and extensions to existing application blocksFeatures include:
Code generation in either C# or Visual Basic .NETSolution templates for Application Blocks and Provider LibrariesRecipes to create custom providers for Enterprise Library application blocksRecipes to create new factories, provider bases and providers for your own blocksRecipes to create design-time configuration code from runtime configuration classes
Application Block Software Factory
Agenda
IntroductionNew Application Blocks
Validation Application BlockPolicy Injection Application Block
Improvements to Existing Application Blocks Configuration ImprovementsApplication Block Software Factoryfinally {
Migration from previous versionsEntLib 3.0/3.1 are 100% API
compatible with the previous January 2006 release of Enterprise LibraryConfiguration formats for existing blocks are unchanged, but assembly version numbers and possibly public key tokens will need to be changed2.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
Resources
Download Enterprise Library and related resources from:
http://msdn.microsoft.com/practices Join the Enterprise Library Community at:
http://codeplex.com/entlib Download or contribute to community extensions at
http://codeplex.com/entlibcontrib Read blogs from the Enterprise Library team at:
http://blogs.msdn.com/tomhollhttp://blogs.msdn.com/agile
Microsoft Solutions Development Centre
A fully equipped project delivery environment hosted within Microsoft AustraliaA specialist engineering facility for delivering high quality software quicklyA way of tapping into external skills and resources while using your own teamThe SDC is a unique way to reduce project risk, get the job done and pick up skillshttp://microsoft.com.au/sdc or [email protected]
Evaluation Forms
Questions?
[email protected]://blogs.msdn.com/tomholl
© 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.