12.07.2015 Views

Discover Enterprise Library - Willy .Net

Discover Enterprise Library - Willy .Net

Discover Enterprise Library - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ContentsLAB 1 C# CONFIGURATION BLOCK ......................................................................................................................1Lab Objective .........................................................................................................................................................1Exercise 1: Writing custom settings to a configuration file....................................................................................1Exercise 2: Reading custom settings from a configuration file ...........................................................................10Exercise 3: Configuration file watcher.................................................................................................................11Lab Summary .......................................................................................................................................................12LAB 2 C# DATA ACCESS BLOCK.........................................................................................................................13Lab Objective .......................................................................................................................................................13Exercise 1: Dynamic SQL with the Data Access Block.......................................................................................13Exercise 2: Stored Procedures and Updates with the Data Access Block .........................................................20Exercise 3: Encrypting Connection Information ..................................................................................................23Lab Summary .......................................................................................................................................................27LAB 3 C# CACHING BLOCK ..................................................................................................................................28Lab Objective .......................................................................................................................................................28Exercise 1: Using the Caching Block for performance........................................................................................28Exercise 2: Persistent Caching and Encryption ..................................................................................................33Lab Summary .......................................................................................................................................................38LAB 4 C# ENTERPRISE LIBRARY LOGGING HANDS ON LAB..........................................................................39Lab Objective .......................................................................................................................................................39Exercise 1: Add Logging to an Application..........................................................................................................39Exercise 2: Create and use a custom log sink....................................................................................................48Exercise 3: Create and use a custom log formatter............................................................................................54Lab Summary .......................................................................................................................................................57LAB 5 C# EXCEPTION HANDLING BLOCK..........................................................................................................58Lab Objective .......................................................................................................................................................58Exercise 1: Logging Exceptions ..........................................................................................................................58Exercise 2: Exception Handling Strategies .........................................................................................................69Lab Summary .......................................................................................................................................................75LAB 6 C# CRYPTOGRAPHY BLOCK ....................................................................................................................76Lab Objective .......................................................................................................................................................76Exercise 1: Encrypt and Decrypt secrets ............................................................................................................76Exercise 2: Use a HashProvider to store a one-way hashed password .............................................................84Lab Summary .......................................................................................................................................................92LAB 7 C# ENTERPRISE LIBRARY SECURITY HANDS ON LAB ........................................................................93Lab Objective .......................................................................................................................................................93Exercise 1: Secure an Application ......................................................................................................................93Exercise 2: Use Task Based Authorization In an Application ...........................................................................106Exercise 3: Application Personalization ............................................................................................................111Lab Summary .....................................................................................................................................................115LAB 8 C# BUILD YOUR OWN BLOCK.................................................................................................................116Lab Objective .....................................................................................................................................................116Exercise 1: Review Current Application ............................................................................................................116Page ii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!