Enterprise Library Sample Projects

The following sample projects illustrate various Enterprise Library concepts and techniques.

Extended Properties Trace Listener with Custom Exception Handler

Description

This solution contains a sample of a Custom Exception Handler that uses a custom Trace Listener to log exception details to a database (as extended properties).

Download: ExtendedPropertyDatabaseListenerWithExceptionLogging.zip

Requirements

This sample application requires:

o Enterprise Library 5 Optional Update 1 (version 5.0.505.0)
o Microsoft .NET Framework 3.5 with Service Pack 1 or Microsoft .NET Framework 4.0
o Microsoft Visual Studio 2010
o A database that is supported by a .NET Framework 3.5 with Service Pack 1 or .NET Framework 4.0 data provider

 

WCF Exception Shielding With Logging Exception Handler

Description

This solution contains a sample of using WCF Exception Shielding as well as using the Logging Exception Handler to log to a flat file.  

To Run, set Service1.svc as the start page (resolve Enterprise Library references if required) and use Ctrl-F5 to start the WCF Test Client and then invoke the GetData method.  The XML response should show MyFaultContract returned and the file trace.log in the web site should contain error information.

Download: WcfEhabShielding.zip

Requirements

This sample application requires:

o Enterprise Library 5 Optional Update 1 (version 5.0.505.0)
o Microsoft .NET Framework 3.5 with Service Pack 1 or Microsoft .NET Framework 4.0
o Microsoft Visual Studio 2010

Silverlight Remote Service Trace Listener Sample

Description

This solution contains a sample using the Silverlight Remote Trace Listener to send messages from a Silverlight client to a WCF service where the message is logged to a file and the event log.  

Consult the ReadMe.txt file in the download for more information.

Requirements

This sample application requires:

o Silverlight Integration Pack for Microsoft Enterprise Library 5.0
o Enterprise Library 5 Optional Update 1 (version 5.0.505.0)
o Silverlight 4
o Microsoft .NET Framework 3.5 with Service Pack 1 or Microsoft .NET Framework 4.0
o Microsoft Visual Studio 2010


Rolling XML Trace Listener Sample & (Rolling) Flat File Trace Listeners

Description

This solution contains a sample of a rolling XML Trace Listener.  The functionality is based on (and leverages some of the functionality of) the Rolling Flat File Trace Listener so it should share the same behavior as that trace listener.  The only difference is that the XML Trace Listener does not support a Header, Footer, or Formatter as the Rolling Flat File Trace Listener does.  

The Rolling XML Trace Listener also support full design time integration with the Enterprise Library configuration tool.  Simply copy the assembly into the config tool working folder (e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin) so it can load the trace listener type. 

This solution also contains a Rolling XML Trace Listener as well as Flat File Trace Listener.  The functionality is based on the Rolling Flat File Trace Listener and Flat File Trace Listener so it should share the same behavior as those trace listeners.  The only difference is that these new implementations resolve an issue where an error occurs during initialization preventing any logging from working by throwing an exception back to the caller when attempting to resolve a LogWriter from the container.  In the configuration tool they should appear as "Custom Rolling Flat File Trace Listener" and "Custom Flat File Trace Listener".

Requirements

This sample application requires:

o Enterprise Library 5 Optional Update 1 (version 5.0.505.0)
o Microsoft .NET Framework 3.5 with Service Pack 1 or Microsoft .NET Framework 4.0
o Microsoft Visual Studio 2010

Custom Database Trace Listener Sample

Description

This sample project shows a sample of a Custom Database Trace Listener that adds an additional column to the out of the boxFormattedDatabaseTraceListener.  The CustomDatabaseTraceListener will check the LogEntry to see if it is a CustomLogEntry and if it is then it will add the CustomData information into the CustomData column in the [Log] table.  

The Custom Database Trace Listener also support full design time integration with the Enterprise Library configuration tool.  Simply copy the assembly into the config tool working folder (e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin) so it can load the trace listener type. 

Requirements

This sample application requires:

o Enterprise Library 5 Optional Update 1 (version 5.0.505.0)
o Microsoft .NET Framework 3.5 with Service Pack 1 or Microsoft .NET Framework 4.0
o Microsoft Visual Studio 2010
o A database that is supported by a .NET Framework 3.5 with Service Pack 1 or .NET Framework 4.0 data provider

Last edited Oct 7, 2013 at 6:20 PM by randylevy, version 20

Comments

No comments yet.