Enterprise Library - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Enterprise Library

Description:

Download from Microsoft (~10MB): http://msdn.microsoft.com/library/default.asp? ... provide a better experience than using notepad to edit XML configuration files ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 23
Provided by: panay
Category:

less

Transcript and Presenter's Notes

Title: Enterprise Library


1
Enterprise Library
  • Microsoft Patterns Practices

Panayiotis Panayiotou
2
Agenda
  • What are patterns practices?
  • Enterprise Library Overview
  • Enterprise Library Application Blocks
  • Demos
  • Future Plans.
  • Useful Links

3
Sounds familiar?
  • What is the industry acceptable way of ..
  • Writing a component to make it simpler to call
    stored procedures or retrieving data in a dataset
  • Debates about where to store configuration
    information
  • Building a component that allows you to log
    errors to different sources
  • Doing automatic application updates to windows
    applications.
  • Building framework / infrastructure components to
    generally simplify app development
  • Searching on the internet thinking

4
What are patterns practices?
  • Patterns Practices provide deep technical
    guidance based on real-world experience,
    recommendations demonstrating how to design,
    develop, deploy, and operate architecturally
    sound applications for the Microsoft .NET
    platform.
  • Both documentation/samples and ready to use
    functionality from within our solutions
  • Patterns practices are proven practices to help
    you generate predictable results.

5
patterns practicesArchitecture Guidance for
the Enterprise
Proven Based on field experience Authoritative
Offer the best advice available
Accurate Technically validated and tested
Actionable Provide the steps to success
Relevant Address real-world problems based on
customer scenarios
Available online http//www.microsoft.com/practi
ces Books available http//www.amazon.com/pract
ices
Application Blocks
Patterns
Reference Architectures
Atomic solutions to recurring problems
Sub-system-level guidance for common services
System-level guidance for common customer
scenarios
D
A
D
I
D
A
D
I
A
A
D
D
I
I
Guides Guidance for broad horizontal topics such
as security, performance, deployment and
operations
6
What up..?
  • Application blocks have been around for a couple
    of years
  • The idea behind the Enterprise Library
  • Consistency
  • Apply consistent design patterns and
    implementation approaches
  • Extensibility
  • Customize block behavior by plugging in their own
    code or customize by directly modifying source
    code
  • Ease of Use
  • Leverage a graphical configuration tool
  • Provide a simpler installation procedure
  • Include clear and complete documentation and
    samples
  • Integration
  • Designed to work well together.
  • But it should also be possible to use the
    application blocks individually

Exception AB April 2002
Data AB Jan 2003
Caching AB UIP AB Updater AB June 2003
Data AB 2.0 Logging AB 2.0 March 2004
UIP AB 2.0 April 2004
EntLib 1 Jan 2005
EntLib 1 update Jun 2005
7
Obtaining the Enterprise Library
  • Download from Microsoft (10MB)
    http//msdn.microsoft.com/library/default.asp?url
    /library/en-us/dnpag2/html/entlib.asp
  • The .EXE file includes documentation, source
    code, Quick start samples, unit tests
  • Run the Installation that will copy files and
    create a group.
  • Good practice to Build the Library
  • Start ? Programs ? Microsoft patterns practices
    ? Enterprise Library ? Build Ent. Library
  • After installing the Enterprise Library be sure
    to run the Install Services program, otherwise
    youll get exceptions when attempting to use the
    DAAB.
  • Start ? Programs ? Microsoft patterns practices
    ? Enterprise Library ? Install Services

8
Enterprise Library v1
Caching
Exception Handling
Security
Logging Instrumentation
Crypto
Data Access
Config Run-Time
Config Tooling
9
Data Access Application Block
  • Provides access to the most often used features
    of ADO.NET with applied best practices
  • Improve Consistency
  • Write code that works against multiple database
    brands (caveats apply!)
  • Improve Security
  • Leverages the configuration application block to
    securely store connection strings
  • Improve ease of use
  • Easily call a stored procedure with one line of
    code

10
How to use the DAAB?
  • Step 1 Configure the Data Access Block
  • You will need an app.config (or web.config) file
    for your application
  • Use the Enterprise Library Configuration tool to
    create the configuration for the data access
    application block
  • Step 2 Create an Instance of Database
  • Step 3 Executing SQL Commands

' Create the default database instance Dim db As
Database DatabaseFactory.CreateDatabase() '
Use a named instance to map to configuration Dim
salesDb As Database DatabaseFactory.CreateDataba
se("Sales")
// Invoke a SQL Command productDataSet
db.ExecuteDataSet(CommandType.Text, "SELECT
ProductID, ProductName FROM Products")
11
DEMO
12
Securing Connection Strings
  • The encryption configuration determines how the
    application block configuration will be encrypted

13
Securing Connection Strings
  • From this

lt?xml version"1.0" encoding"utf-8"?gt ltdataConfig
urationgt ltxmlSerializerSection gt
ltenterpriseLibrary.databaseSettings gt
ltdatabaseTypesgt ltdatabaseType name"Sql
Server" type"Microsoft.Practices.EnterpriseLibrar
y.Data.Sql.SqlDatabase, Microsoft.Practices.Enterp
riseLibrary.Data" /gt lt/databaseTypesgt
ltinstancesgt ltinstance name"DataAccessQuic
kStart" type"Sql Server" connectionString"LocalQ
uickStart" /gt lt/instancesgt
ltconnectionStringsgt ltconnectionString
name"LocalQuickStart"gt ltparametersgt
ltparameter name"database"
value"EntLibQuickStarts" isSensitive"false" /gt
ltparameter name"Integrated Security"
value"True" isSensitive"false" /gt
ltparameter name"server" value"localhost"
isSensitive"false" /gt lt/parametersgt
lt/connectionStringgt lt/connectionStrings
gt lt/enterpriseLibrary.databaseSettingsgt
lt/xmlSerializerSectiongt lt/dataConfigurationgt
  • To this

??????c???????????????????????????????????????????
??????????????????????????????????????????????????
??????????????????????????????????????????????????
??????????????????????????????????????????K???????
????u?????????????????????????????????????????????
??????????????????????????????????????????????????
??????????????????????????????????????????????????
???????????????????????????
14
DEMO
15
Configuration Application Block
  • Application needs to read and/or write complex
    configuration data at runtime
  • Application which must store sensitive data
    (password) in configuration
  • Application or block with design time support in
    the form of property pages, wizards and
    validation to assist developers in getting
    configuration right
  • Administrator deploying an application needs to
    change configuration and you want to provide a
    better experience than using notepad to edit XML
    configuration files

16
Configuration Application Block
  • Provides a general purpose configuration runtime
    which allows applications to easily read and
    write configuration data from configurable
    storage locations
  • Configuration Tool (Design-time)
  • Uses Configuration Application Block
  • Improves ease of use
  • Wizards
  • Property Sheets
  • Validation
  • Improves Security
  • Supports Encryption
  • Configuration Application Block (Runtime)
  • Improves integration
  • Supports pluggable storage providers and
    transformations
  • Improves ease of use
  • Read Write Model
  • Supports object graphs
  • Notifications when config store changes
  • Improves Security
  • Supports Encryption

17
DEMO
18
Logging Instrumentation Application Block
  • Provides a simple model for logging events
  • Replaces the Enterprise Instrumentation Framework
    and the existing Logging Application Block
  • Configuration driven you decide what messages
    are logged where at runtime.
  • Sinks provided include
  • Event Log
  • Database
  • Text File
  • MSMQ

19
Logging - Example
  • Dim log As LogEntry New LogEntry
  • log.Message Your message here
  • log.Priority 1
  • log.EventId 100
  • log.Category "Debug"
  • Logger.Write(log)

// Or if you prefer one line... Customer cust
GetCustomer(123) // Log the customer will call
// cust.ToString() for the log
entry Logger.Write(cust, Category, Priority)
20
DEMO
21
Future plans
  • Just released an update to Version 1.0 released
    in Jan 2005.
  • Additional capabilities and scenarios
  • New blocks, such as Validation
  • Updating existing application blocks
  • Scenarios such as Smart Client
  • Enablement
  • Visual Studio tooling and wizards
  • Deeper community penetration
  • .NET 2.0 / Visual Studio 2005 release
  • Blocks revved to adhere to best practices of new
    platform
  • Integration with new VS2005 experiences

22
Useful Links
Microsoft Patterns Practices Web
Site http//microsoft.com/practices Enterprise
Library Community http//workspaces.gotdotnet.com
/entlib http//practices.gotdotnet.com/workspace.
aspx?id295a464a-6072-4e25-94e2-91be63527327 http
//patternshare.org/
Write a Comment
User Comments (0)
About PowerShow.com