I created another screencast over the weekend showing how you can integrate Unity with Enterprise Library 4.0:
This screencast discusses the Logging Application Block with Unity. The Logging Application Block comes with a LoggingBlockExtension that adds the various configuration information into Unity so you can inject a LogWriter Class into your custom business classes. This is very similar to how the Data Access Application Block works with Unity as I showed in a previous screencast:
The screencast walks through a Model-View-Presenter type scenario where you have an AddCustomerPresenter Class with a dependency on an ICustomerDataSource that has a dependency on the LogWriter Class in the Logging Application Block. The screencast shows how to create the UnityContainer, add the appropriate Enterprise Library Unity Extensions, add additional type mappings, etc. The example uses a simple Rolling Flat File TraceListener and shows you the new Midnight Rollover Setting for incremental daily log files.
If you are interested in the Validation Application Block with Unity, you can also check out that previous screencast as well:
- Enterprise Library Logging Application Block Part I – TraceListeners
- Enterprise Library Logging Application Block Part II – Simple ASP.NET 2.0 Website Example – Logging Unhandled Exceptions
- Enterprise Library Logging Application Block Part III – Programmatically Using Logging Application Block With No Configuration File
- Enterprise Library Logging Application Block Part IV – Conclusion – Free .NET Tutorials and Examples
I hope the Logging Application Block Screencast proves somewhat useful.