• No results found

rpafi/tl enterprise Microsoft Enterprise Library 5.0 Develop Enterprise applications using reusable software

N/A
N/A
Protected

Academic year: 2021

Share "rpafi/tl enterprise Microsoft Enterprise Library 5.0 Develop Enterprise applications using reusable software"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Microsoft

Enterprise

Library

5.0

Develop

Enterprise

applications

using

reusable software

components

of

Microsoft

Enterprise Library

5.0

Sachin Joshi

rpAfi/Tl

enterprise

I I jflv

|\ I

I

professional expertise distilled PUBLISHING

(2)

Table

of

Contents

Preface 1

Chapter

1:

Getting

Started with

Enterprise

Library 5

Introducing

Enterprise Library 6

Wiring Application Blocks 7

Unity Application

Block 7

Policy Injection Application

Block 7 FunctionalApplication Blocks 7 Data Access

Application

Block 8

Logging Application

Block 8

Exception Handling Application Block 8

Caching Application

Block 9

Validation

Application

Block 9

Security

Application Block 9

Cryptography Application

Block 10

Functional

Application

Block

Dependency

10

System requirements

12

Installing Enterprise Library 13

Enterprise

Library

Binaries 13

Configuration

Editor for Visual Studio 13 Source Codeof

Enterprise

Library 14

Summary 17

Chapter

2: Data Access

Application

Block 19

Working

of Data AccessApplication Block 20

Developing

an

application

21

Referencing

the

required

assemblies 22

Adding

Data Access

Settings

23

Adding

a namespace 27

(3)

TableofContents

SqIDatabase class 29

SqICeDatabase class 30 OracleDatabase class 31

GenericDatabase class 31

Creatinga Database instance 32

Usingthe DatabaseFactoryclass 32

UsingUnityservice locator 33

Using Unitycontainerdirectly 33

Retrieving

records

using

ExecuteReader 34

Retrieving

records using DataSet 35

Retrieving a recordas an object 35

Parameter mappers 36

Outputmappers 38

Defaultrowmappers 38 Rowmapping using MapBuilder 38

RowmappingusingIRowMapper<TResult> 38 ResultSet mappers 39

Data Accessors 40

Creating

and executingAccessors 41

Retrieving multiple recordsas an objectcollection 42

Retrieving records asXML 43

Executing

acommand

using ExecuteNonQuery

44

Retrieving

scalar values 45

Updating

records using DataSet 46

Working with transactions 48

Summary 50

Chapter 3: Logging

Application

Block 51

Developing

an

application

53

Referencing

assemblies 53

Adding Logging

Settings 55

Adding

namespaces 57

Writing

a

log

message 58

Exploring design

elements 60

LogEntry

60

Logger

64

Using Logger 66

LogWriter

66

Adding

tracesource categories 69

Configuringspecialcategories 70

Configuringlogcategories 71

Configuring

tracelisteners 72

ConfiguringEventLogTrace Listener 74

(4)

Configuring Rolling Flat File Trace Listener 77

ConfiguringXMLTrace Listener 78

Configuring DatabaseTraceListener 79

Configuringto sendlogmessages toane-mailaddress 81

Configuring System DiagnosticsTrace Listener 83 Configuring Message QueuingTrace Listener 84

ConfiguringWMITrace Listener 87

Configuring customtracelisteners 87

Configuring log

message formatters 88

Configuring logging

filters 90

Adding acategoryfilter 91

Adding alogging enabledfilter 92

Adding a priorityfilter 93

TraceManagerand Tracer 94

Tracingactivities 94

Customizing

Logging

block elements 96

Implementingacustomtrace listener 96

Implementinga custom logformatter 98

Implementingacustom logfilter 100

Summary

102

Chapter

4:

Exception Handling Application

Block 103

Developing an

application

104

Referencing required

assemblies 105

Adding

initial

Exception Handling settings

106

Adding

namespaces 108

Understanding

the Exception Handling block 108

Exception policy 108

Exceptiontypes 109

Exceptionhandler 109

Exception Managerclass 111

Stitching together: Exception Policy/Type/Handler

113

Creating

an

Exception Handling

block

object

113

UsingtheExceptionPolicy class .114

Using Unityservice locator 114

Using Unitycontainerdirectly 115

Wrapping anexception using Wraphandler 115

Configuring a Wrap

exception

handler 116

Replacing

an

exception using

Replace handler 118

Configuring

a

Replace

handler 118

Logging an exception using Logginghandler 121

Configuring a Logging handler 122

WCF fault contractexception handler 124

Generic fault contract creation 124

(5)

TableofContents

Applying

the

ExceptionShielding

attribute 126

Exception handling:

WCF Service consumer 126

Implementing customexception handler 127

Configuring custom

exception

handler 128

Summary

129

Chapter 5:

Caching

Application Block 131

Developing an application 133

Referencing

the

required

assemblies 134

Adding the initial Caching Settings 135

Adding

namespaces 137

Creating

the

CacheManager

instance 137

Usingthe staticfactoryclass 138

UsingtheUnityServiceLocator 139

Usingthe Unitycontainerdirectly 139

Configuring the

in-memory

backing store 140

Adding

itemstocache 141

Understandingthe expirationprocess 142

Expiration

policies

143

Understandingthe Scavenging process 143

Reading cached items 144

Removing

cached items 145

Flushing

cached items 145

Reloading expired

items 145

Configuring

Isolated Cache Storage

Backing

Store 146

Configuring DatabaseCache

Storage

148

Configuring

and encrypting cached data 149

Configuration steps

150

Summary

154

Chapter

6: ValidationApplication Block 155 ValidationApplication Block features 156

Developing an application 157

Referencing

the

required

assemblies 158

Adding

namespaces 160

Understanding

Validators 161

Value Validators 161

ObjectValidators 163

Single

Member Validators 163

Composite Validators 164

Understanding

Rule Sets 165

Understanding ValidatorFactory

165

(6)

Validating objects using

attributes 167

Validating

values programmatically 169

Validating

objects using self-validation 170

Validating objects using configuration 171

Integrating withWindows Forms-based

applications

179

Steps

to

leverage

ValidationProvider 180

Integrating

the Validation block with ASP.NET 183

Implementing

a Custom Validator 184

Summary 186

Chapter 7: Security Application Block 187

Developing

an

application

189

Referencing required/optional

assemblies 190

Adding

initialsecurity settings 191

Addingnamespaces 193

Creating security application

block

objects

194 Usingthe staticfactoryclass 194

Using Unityservice locator 194 UsingUnitycontainerdirectly 195

Understanding

Authorization Providers 196 Authorization Rule Provider 197 AzMan Authorization Provider 202

Understanding Security

Cache Provider 203 CachingStoreProviderclass 204

Configuring SecurityCache Provider 204

Cachingandgeneratingatokenforanauthenticated user 205

Associating a token with User

Identity,

Principal and Profile

objects

206

RetrievingUserIdentity, UserPrincipal,and Profileobjects 207

Expiring UserIdentity,UserPrincipal,and Profileobjects 208

Implementing a custom Authorization Provider 210

Custom XMLAuthorization Provider 211

Summary

211

Chapter

8:

Cryptography Application

Block 213

Developing an application 215

Referencing required and optional assemblies 216

Adding

namespaces 216

Adding

initial

cryptography settings

217

Working

of Hash Provider 219

Creating CryptographyManager

and IHashProvider instances 220 Usingthe static facade 221 UsingUnityservice locator 221

(7)

TableofContents

Configuring

Hash Provider 222

Generating

a hash value 224

Comparing hash values 224

Implementing a custom Hash Provider 225

ConfiguringaCustom Hash Provider 226

Working

of

symmetric cryptography providers

228

Creating CryptographyManager

and

ISymmetricCryptoProvider

instances 230

Usingthe staticfacade 230

Using Unityservice locator 230

Using Unitycontainerdirectly 230

Configuring the symmetric

cryptography provider

231

Exporting

the

key

235

Encrypting

data 236

Decrypting

data 236

Implementing

acustom symmetric provider 237

Configuringthe customsymmetricprovider 238

Summary

239

Index 241

References

Related documents

In the present study, we aimed to introgress high levels of LLS and rust resistance from diploid wild Arachis species into cultivated peanut to develop ILs with enhanced levels

Congratulations to the Marrara Christian College team who were the top Northern Territory team in the 2015 Australian National Titration Competition.. They met the criteria for a

immigration, migration, refugees, asylum, Syria, Honduras, Cuba, empathy, storytelling, narrative, Cuban Adjustment Act, Temporary Protected Status, deferred action, parole, policy,

Foreign banks are allowed to open up to eight branches in the country (in theory, one in each emirate), but only seven banks operate eight branches. The UAE

Table A2 shows the variances of the policy instrument, the CPI inflation rate and the change in the nominal exchange rate under simple commitment where the proposed target

– Start with a test migration of databases and thoroughly review – Create, test and deploy critical forms and reports. – Create, test and deploy critical forms

¾ Under forward bias (VBE &gt; 0), majority carriers (electrons) are “pushed away from” the negative terminal of V BE over the lowered potential barrier and injected into the

Therefore, seamless integration of wired and wireless services for future-proof access networks will lead to the convergence of ultimate high bandwidth for both fixed and