Adding Application Code
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
|The latest Enterprise Library information can be found at the Enterprise Library site.|
The following procedure explains how to incorporate the Policy Injection Application Block into your application.
To prepare your application
Add a reference to the Policy Injection Application Block assembly. In Visual Studio, right-click your project node in Solution Explorer, and then click Add Reference. Click Browse, and then locate the Microsoft.Practices.EnterpriseLibrary.PolicyInjection.dll assembly. Select this assembly, and then click OK to add the reference.
Use the same procedure to set a reference to the Enterprise Library Common assembly, named Microsoft.Practices.EnterpriseLibrary.Common.dll.
Follow the same procedure to add a reference to the ObjectBuilder assembly, Microsoft.Practices.ObjectBuilder2.dll.
Follow the same procedure to add a reference to the Unity assembly, Microsoft.Practices.Unity.dll.
Follow the same procedure to add a reference to the Unity Interception assembly, Microsoft.Practices.Unity.Interception.dll.
If you are using the built-in handlers that use the features of other Enterprise Library application blocks, add a reference to the Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.dll assembly, and then add references to the Enterprise Library application blocks used by these handlers.
(Optional) To use elements from the Policy Injection Application Block without fully qualifying the element reference, add the following using statements (C#) or Imports statements (Visual Basic .NET) to the top of your source code file.
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection; using Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers;
'Usage Imports Microsoft.Practices.EnterpriseLibrary.PolicyInjection Imports Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers
For Visual Basic .NET projects, you can use the References page of the Project Properties Designer to manage references and imported namespaces. To access the References page, select a project node in Solution Explorer. On the Project menu, click Properties. When the Project Properties Designer appears, click the References tab.