Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Getting Started with Enterprise Library 3.0  in ASP.NET Alex Homer [email_address]
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
What is Enterprise Library? <ul><li>Enterprise Library is: </li></ul><ul><ul><li>A library of application blocks that solv...
What is Enterprise Library? <ul><li>Enterprise Library is NOT: </li></ul><ul><ul><li>Part of the .NET Framework </li></ul>...
The Application Blocks (1) <ul><li>Caching  Application Block: </li></ul><ul><ul><li>A local cache for use in all applicat...
The Application Blocks (2) <ul><li>Policy Injection  Application Block: </li></ul><ul><ul><li>Add handler pipelines to met...
Blocks and Dependencies Security Crypto Configuration Data  Access Logging Caching Exception Handling Dependency Plug-in C...
Instrumentation <ul><li>Instrumentation is now a core part: </li></ul><ul><ul><li>Windows Events </li></ul></ul><ul><ul><l...
Enterprise Library Architecture
Configuration Tools Graphical stand-alone Configuration Console and Visual Studio 2005 Configuration Editor Both create or...
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
Installing Enterprise Library <ul><li>Download as a .EXE from MSDN (address on last slide) and run it to install: </li></u...
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
The Quick Start Examples <ul><li>Simple Windows Forms applications: </li></ul><ul><ul><li>Demonstrate the main features of...
The Quick Start Examples <ul><li>For example: </li></ul>
Running the Quick Starts  Demo
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
Enterprise Library and ASP.NET <ul><li>Can be used in any ASP.NET application </li></ul><ul><li>Configure just the blocks ...
Enterprise Library in ASP.NET  Demo
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
Trust Levels and Permissions Root  Web.config  file Medium   trust  definitions  file Low trust  definitions  file Minimal...
Trust Levels and Permissions Root  Web.config  file Medium   trust  definitions  file Low trust  definitions  file Minimal...
Trust Levels and Permissions Root  Web.config  file Medium   trust  definitions  file Low trust  definitions  file Minimal...
Trust Levels and Permissions Internal default settings Root  Web.config  file Medium   trust  definitions  file Low trust ...
Partial Trust <ul><li>Root Web.config specifies the &quot;trust&quot; files: </li></ul><ul><li><system.web> </li></ul><ul>...
Partial Trust <ul><li>Each &quot;trust&quot; lists the permission classes: </li></ul><ul><li><SecurityClasses> </li></ul><...
Partial Trust <ul><li>Each &quot;trust&quot; file also specifies permissions: </li></ul><ul><li><NamedPermissionSets> </li...
Using Partial Trust in ASP.NET  Demo
Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start E...
Writing Custom Providers <ul><li>Each block uses pluggable providers to connect to its data source, output target, or func...
Cache Backing Store Providers <ul><li>In-memory cache for high performance </li></ul><ul><li>Pluggable provider for backin...
Caching Block <ul><li>Base class provides core functionality </li></ul><ul><li>You just override the methods to interact w...
A Custom Caching Provider  Demo
References <ul><li>Book covering Enterprise Library: </li></ul><ul><ul><li>&quot;Effective Use of Microsoft Enterprise Lib...
Upcoming SlideShare
Loading in …5
×

Getting Started with Enterprise Library 3.0 in ASP.NET

5,764 views

Published on

Published in: Technology
  • Be the first to comment

Getting Started with Enterprise Library 3.0 in ASP.NET

  1. 1. Getting Started with Enterprise Library 3.0 in ASP.NET Alex Homer [email_address]
  2. 2. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  3. 3. What is Enterprise Library? <ul><li>Enterprise Library is: </li></ul><ul><ul><li>A library of application blocks that solve common challenges </li></ul></ul><ul><ul><li>A set of helper classes that work in any architectural style </li></ul></ul><ul><ul><li>Architectural guidance embodied in code, which ships with full source allowing you to modify and extend it </li></ul></ul><ul><ul><li>Available as a free download </li></ul></ul>
  4. 4. What is Enterprise Library? <ul><li>Enterprise Library is NOT: </li></ul><ul><ul><li>Part of the .NET Framework </li></ul></ul><ul><ul><li>An application framework that imposes an architectural style </li></ul></ul><ul><ul><li>A Microsoft product with support, compatibility and localization </li></ul></ul><ul><ul><li>Available to purchase </li></ul></ul>
  5. 5. The Application Blocks (1) <ul><li>Caching Application Block: </li></ul><ul><ul><li>A local cache for use in all applications </li></ul></ul><ul><li>Cryptography Application Block: </li></ul><ul><ul><li>Hashing and symmetric encryption functions </li></ul></ul><ul><li>Data Access Application Block: </li></ul><ul><ul><li>Standard database access functionality </li></ul></ul><ul><li>Exception Handling Application Block: </li></ul><ul><ul><li>Consistent strategy for processing exceptions </li></ul></ul><ul><li>Logging Application Block: </li></ul><ul><ul><li>Standard logging functionality </li></ul></ul>
  6. 6. The Application Blocks (2) <ul><li>Policy Injection Application Block: </li></ul><ul><ul><li>Add handler pipelines to methods/properties </li></ul></ul><ul><li>Security Application Block: </li></ul><ul><ul><li>Authorization and security caching functionality </li></ul></ul><ul><li>Validation Application Block: </li></ul><ul><ul><li>Wide range of validation capabilities for objects </li></ul></ul><ul><li>Enterprise Library also includes: </li></ul><ul><ul><li>A set of core functions , including configuration, instrumentation , and object builder services. These functions are used by all other application blocks. </li></ul></ul>
  7. 7. Blocks and Dependencies Security Crypto Configuration Data Access Logging Caching Exception Handling Dependency Plug-in Config Tools Core Policy Injection Validation
  8. 8. Instrumentation <ul><li>Instrumentation is now a core part: </li></ul><ul><ul><li>Windows Events </li></ul></ul><ul><ul><li>Performance Counters </li></ul></ul><ul><ul><li>WMI Events </li></ul></ul><ul><li>Requires Installation and “Switch on”: </li></ul><ul><ul><li>Run a utility from Start menu </li></ul></ul><ul><ul><li>Edit App.config or Web.config </li></ul></ul><ul><ul><li><instrumentationConfiguration </li></ul></ul><ul><ul><li>eventLoggingEnabled=&quot;true&quot; wmiEnabled=&quot;true&quot; </li></ul></ul><ul><ul><li>performanceCountersEnabled=&quot;true&quot; /> </li></ul></ul>
  9. 9. Enterprise Library Architecture
  10. 10. Configuration Tools Graphical stand-alone Configuration Console and Visual Studio 2005 Configuration Editor Both create or modify App.config or Web.config
  11. 11. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET 2.0 </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  12. 12. Installing Enterprise Library <ul><li>Download as a .EXE from MSDN (address on last slide) and run it to install: </li></ul><ul><ul><li>The Library Application Blocks and source code </li></ul></ul><ul><ul><li>The Configuration Console </li></ul></ul><ul><ul><li>Utilities to compile and install the Library </li></ul></ul><ul><ul><li>Quick Start examples for each block </li></ul></ul><ul><ul><li>VS 2005 projects for Library and Quick Starts </li></ul></ul><ul><ul><li>Unit test projects for NUnit and VSTS </li></ul></ul><ul><ul><li>Utilities to create and install databases, backing stores, and instrumentation </li></ul></ul><ul><ul><li>Help files and release notes </li></ul></ul>
  13. 13. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET 2.0 </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  14. 14. The Quick Start Examples <ul><li>Simple Windows Forms applications: </li></ul><ul><ul><li>Demonstrate the main features of the block </li></ul></ul><ul><ul><li>Show how to use the block in your application </li></ul></ul><ul><ul><li>Contain links to Walkthroughs that explain the workings of the block and the code </li></ul></ul><ul><ul><li>Provided in both VB.NET and C# </li></ul></ul><ul><ul><li>Demonstrate best practice techniques </li></ul></ul>
  15. 15. The Quick Start Examples <ul><li>For example: </li></ul>
  16. 16. Running the Quick Starts Demo
  17. 17. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET 2.0 </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  18. 18. Enterprise Library and ASP.NET <ul><li>Can be used in any ASP.NET application </li></ul><ul><li>Configure just the blocks you require </li></ul><ul><li>The most useful blocks in ASP.NET are: </li></ul><ul><ul><li>Data Access </li></ul></ul><ul><ul><li>Caching </li></ul></ul><ul><ul><li>Logging </li></ul></ul><ul><ul><li>Cryptography </li></ul></ul><ul><ul><li>Policy Injection </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><li>You can install a Partial Trust Patch </li></ul><ul><ul><li>Run your ASP.NET application in a specified custom Trust mode </li></ul></ul>
  19. 19. Enterprise Library in ASP.NET Demo
  20. 20. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET 2.0 </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  21. 21. Trust Levels and Permissions Root Web.config file Medium trust definitions file Low trust definitions file Minimal trust definitions file Application Web.config file High trust definitions file Internal default settings
  22. 22. Trust Levels and Permissions Root Web.config file Medium trust definitions file Low trust definitions file Minimal trust definitions file Application Web.config file High trust definitions file <trust level=&quot;High&quot; originUrl=&quot;&quot; /> Internal default settings
  23. 23. Trust Levels and Permissions Root Web.config file Medium trust definitions file Low trust definitions file Minimal trust definitions file Application Web.config file High trust definitions file <trust level=&quot;High&quot; originUrl=&quot;&quot; /> <system.web> <securityPolicy> <trustLevel name=&quot;Full&quot; policyFile=&quot;internal&quot; /> <trustLevel name=&quot;High&quot; policyFile=&quot;web_hightrust.config&quot; /> ... </securityPolicy> <trust level=&quot;Full&quot; originUrl=&quot;&quot; /> </system.web> Internal default settings
  24. 24. Trust Levels and Permissions Internal default settings Root Web.config file Medium trust definitions file Low trust definitions file Minimal trust definitions file Application Web.config file High trust definitions file <SecurityClass Name=&quot;FileIOPermission&quot; ... /> <IPermission class=&quot;FileIOPermission&quot; version=&quot;1&quot; Read=&quot;$AppDir$&quot; Write=&quot;$AppDir$&quot; Append=&quot;$AppDir$&quot; PathDiscovery=&quot;$AppDir$&quot; /> <trust level=&quot;High&quot; originUrl=&quot;&quot; /> <system.web> <securityPolicy> <trustLevel name=&quot;Full&quot; policyFile=&quot;internal&quot; /> <trustLevel name=&quot;High&quot; policyFile=&quot;web_hightrust.config&quot; /> ... </securityPolicy> <trust level=&quot;Full&quot; originUrl=&quot;&quot; /> </system.web>
  25. 25. Partial Trust <ul><li>Root Web.config specifies the &quot;trust&quot; files: </li></ul><ul><li><system.web> </li></ul><ul><li><securityPolicy> </li></ul><ul><li><trustLevel name=&quot;Full&quot; policyFile=&quot;internal&quot; /> </li></ul><ul><li><trustLevel name=&quot;High&quot; policyFile=&quot;web_hightrust.config&quot; /> </li></ul><ul><li>... Medium, Low, and Minimal definitions here ... </li></ul><ul><li></securityPolicy> </li></ul><ul><li><trust level=&quot;Full&quot; originUrl=&quot;&quot; /> </li></ul><ul><li></system.web> </li></ul><ul><li>You can add your own custom &quot;trust&quot; files: </li></ul><ul><li><!-- custom trust level policy file --> </li></ul><ul><li><trustLevel name=&quot;CustomMedium&quot; </li></ul><ul><li>policyFile=&quot;custom_mediumtrust.config&quot; /> </li></ul>
  26. 26. Partial Trust <ul><li>Each &quot;trust&quot; lists the permission classes: </li></ul><ul><li><SecurityClasses> </li></ul><ul><li><SecurityClass Name=&quot;AllMembershipCondition&quot; ... /> </li></ul><ul><li><SecurityClass Name=&quot;AspNetHostingPermission&quot; ... /> </li></ul><ul><li><SecurityClass Name=&quot;DnsPermission&quot; ... /> </li></ul><ul><li>... more security classes here ... </li></ul><ul><li>You can add other permission classes: </li></ul><ul><li><!-- custom security permission classes --> </li></ul><ul><li><SecurityClass Name=&quot;OleDbPermission&quot; ... /> </li></ul><ul><li><SecurityClass Name=&quot;EventLogPermission&quot; ... /> </li></ul><ul><li><SecurityClass Name=&quot;DataProtectionPermission&quot; ... /> </li></ul><ul><li></SecurityClasses> </li></ul>
  27. 27. Partial Trust <ul><li>Each &quot;trust&quot; file also specifies permissions: </li></ul><ul><li><NamedPermissionSets> </li></ul><ul><li><IPermission class=&quot;AspNetHostingPermission&quot; version=&quot;1&quot; </li></ul><ul><li>Level=&quot;Medium&quot; /> </li></ul><ul><li><IPermission class=&quot;DnsPermission&quot; version=&quot;1&quot; </li></ul><ul><li>Unrestricted=&quot;true&quot; /> </li></ul><ul><li>... more security permissions here ... </li></ul><ul><li>You can add your own custom permissions: </li></ul><ul><li><!-- custom OLEDB permission --> </li></ul><ul><li><IPermission class=&quot;OleDbPermission&quot; version=&quot;1&quot;> </li></ul><ul><li><add ConnectionString=&quot;Provider=SQLOLEDB;Database=...&quot; </li></ul><ul><li>KeyRestrictions=&quot;&quot; KeyRestrictionBehavior=&quot;AllowOnly&quot;/> </li></ul><ul><li></IPermission> </li></ul><ul><li><NamedPermissionSets> </li></ul>
  28. 28. Using Partial Trust in ASP.NET Demo
  29. 29. Agenda <ul><li>What is Enterprise Library? </li></ul><ul><li>Getting and Installing It </li></ul><ul><li>The Quick Start Examples </li></ul><ul><li>Using Enterprise Library in ASP.NET 2.0 </li></ul><ul><li>Partial Trust with Enterprise Library </li></ul><ul><li>Writing Providers for Enterprise Library </li></ul>
  30. 30. Writing Custom Providers <ul><li>Each block uses pluggable providers to connect to its data source, output target, or function implementation </li></ul><ul><ul><li>Caching: Backing Store Providers </li></ul></ul><ul><ul><li>Logging: Listeners, Filters and Formatters </li></ul></ul><ul><ul><li>Cryptography: Hash Providers and Symmetric Encryption Providers </li></ul></ul><ul><ul><li>Data Access: Database Providers </li></ul></ul><ul><li>You can create your own custom providers </li></ul><ul><ul><li>Inherit from a suitable base class ... </li></ul></ul><ul><ul><li>... or implement pre-defined interface </li></ul></ul>
  31. 31. Cache Backing Store Providers <ul><li>In-memory cache for high performance </li></ul><ul><li>Pluggable provider for backing store </li></ul><ul><li>You can create a provider to suit your own specific requirements </li></ul>
  32. 32. Caching Block <ul><li>Base class provides core functionality </li></ul><ul><li>You just override the methods to interact with your own backing store </li></ul><ul><li>Take advantage of the helper classes in the Library </li></ul>
  33. 33. A Custom Caching Provider Demo
  34. 34. References <ul><li>Book covering Enterprise Library: </li></ul><ul><ul><li>&quot;Effective Use of Microsoft Enterprise Library: Building Blocks for Creating Enterprise Applications and Services&quot; (Addison-Wesley ISBN 0-321-33421-3). </li></ul></ul><ul><li>All about Enterprise Library: </li></ul><ul><ul><li>http://www.codeplex.com/entlib/ </li></ul></ul><ul><li>Code and Slides for this session: </li></ul><ul><ul><li>http://www.daveandal.net/download/ </li></ul></ul><ul><li>Contact: [email_address] </li></ul>http ://www.codeplex.com

×