Udostępnij za pośrednictwem


Using Enterprise Library in Applications

Enterprise Library can be used in most types of applications and in the majority of scenarios where you require an easy-to-use yet highly flexible library to help you manage crosscutting concerns. For example, you can use Enterprise Library in application built with Windows Forms, Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), ASP.NET, Silverlight®, and console-based applications. You can also use Enterprise Library in both greenfield and brownfield scenarios.

When architecting new applications, Enterprise Library can be used to implement many of the common design patterns you incorporate in your design. You can plan for its use throughout the layers and components of your application. You can also use Enterprise Library successfully in existing applications, where it can help to simplify the task of updating or adding new functionality. The configuration tools do not affect existing information in your application configuration files, and the assemblies and code can be added to existing applications without fear of conflicts.

Enterprise Library includes source code for the application blocks, and compiled and signed versions of the application block assemblies. You can use these assemblies directly, compile the application blocks and use the compiled assemblies, or include the source code in your application. However, before you can use the assemblies in your application, you must add references to the relevant application block assemblies, and to the Common and Unity assemblies. Then, to write application code, you also must be aware of the Enterprise Library namespace conventions and object creation patterns.

This section contains the following topics that will help you to get started using Enterprise Library:

  • Referencing Enterprise Library Assemblies. This topic explains how to add references to the required assemblies to your application, and import these into your projects.
  • Dependencies in Enterprise Library. This topic explains how some of the blocks depend on others, and how all of the blocks depend on core features of Enterprise Library. It will help you to understand which assemblies and features you require depending on the blocks you use and your own scenarios.
  • Creating and Referencing Enterprise Library Objects. This topic describes the various ways of accessing Enterprise Library objects, what their advantages and disadvantages are, and details of how they work in the underlying code.

For information about how to compile the application blocks, see Building Enterprise Library from the Source Code. For information about the design of the dependency injection mechanism, see The Dependency Injection Model.