# [dba-VB] MS Patterns & Practices: Entlib 5.0 and Unity2.0 - they made it finally - that's a real

Gustav Brock gustav at cactus.dk
Mon Sep 13 14:16:26 CDT 2010

Hi Shamil

Serious stuff. Seems like nothing is forgotten. Thanks again!

/gustav

>>> shamil at smsconsulting.spb.ru 13-09-2010 20:50 >>>
Yes, Gustav,

And they have rather well elaborated

Hands-On Labs for Microsoft Enterprise Library 5.0

with sources and .pdf/.xps docs, which TOC can be used as "quick-links" on
real life cases when they will be needed in programming e.g. for Logging
this hands-on labs' TOC is:

? Lab 1: Add Logging to an Application
? Lab 2: Create and Use a Custom Trace Listener
? Lab 3: Create and Use a Custom Log Formatter

-- Shamil

-----Original Message-----
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, September 13, 2010 10:31 PM
Subject: Re: [dba-VB] MS Patterns & Practices: Entlib 5.0 and Unity2.0 -they
made it finally - that's a real

Hi Shamil

Yes, thanks, that's a good and convincing example (the logging). I better
take a closer look!

/gustav

>>> shamil at smsconsulting.spb.ru 13-09-2010 19:09 >>>
Hi Gustav --

I suppose this is the case when one has to find 58 minutes as this time
investment promise to bring big savings in long run.
MS made it this time - I suppose...
I was always quite a bit skeptical about what they were doing in that area
because they were doing that at the beginning as an experiment not as "dog
food to themselves" - and it's now used like that ("dog food for
themselves") there - so this is a real stuff for sure. And one can just
analyze what is done in the most advanced and useful Instrumentation and
Dependency Injection frameworks by today and compare with Entlib5 and Unity
2.0 - and you'll find MS didn't reinvent the wheel MS way creating yet
another "behemoth" - the opposite is true - they have made a lightweight
framework where many parts can be replaced by custom stuff if needed or used
as it's - out of the box etc.

What is also important is that the tuning of used Enterprise Library
Block(s) (e.g. Logging) can be done directly on deployment site without any
programming but by using special config editing tool or within VS using
similar tool/editor:

http://smsconsulting.spb.ru/test/entlib5.jpg

And one can start using Unity 2.0 and, say, Logging block almost immediately
- as in the sample code in P.S. of this message - not the best possible
sample code I could have made - it's just to show how easy is to start with
that advanced Entlib 5 and Unit 2.0 stuff:

- using code in P.S. and tuning of config file you'll get in the log (and
log can be set for MS Windows Event Log, Flat File, Database,...  in config
file):

Message: Test Message 1
Message: Test Message 2

Or

Timestamp: 13/09/2010 16:38:17
Message: Test Message 1
Category: General
Priority: -1
EventId: 1
Severity: Information
Title:
Machine: NANT
App Domain: ConsoleApplication1.exe
ProcessId: 2728
Process Name: G:\Samples\Microsoft Enterprise Library 5.0 - Hands On
Labs\CS\Logging\exercises\ex01\begin\ConsoleApplication1\bin\Debug\ConsoleAp
plication1.exe