Example .NET Config File With Drill Configuration Supporting ASP.NET and ASP.NET MVC

Please consider the minimal Drill configuration in a .NET config file example below:

<?xml version="1.0"?>
		<sectionGroup name="drill">
			<section name="dependencyResolvers" type="Drill.Configuration.ConfigFile.DependencyResolversConfigurationSection, Drill" />
			<dependencyResolver name="MyResolver" type="Drill.Integration.Web.AspNetDrillChuckDependencyResolver, Drill.Integration.Web">
					<drillBit name="MyUnityContainer" type="Drill.DrillBits.Unity.UnityDrillBit, Drill.DrillBits.Unity">
							<cfgSource key="UnityConfigSectionAppConfig" method="ConfigFile" />

This example is exactly the same as the Example .NET Config File with Drill Configuration page with the following key exceptions:
  • The configuration above is part of the Web.config file
  • The Drill.DrillBits.Unity and Drill.Integration.Web NuGet packages are installed
  • The <dependencyResolver> element specifies the type attribute with a value of Drill.Integration.Web.AspNetDrillChuckDependencyResolver, Drill.Integration.Web
The alternate dependency resolver implementation, AspNetDrillChuckDependencyResolver, is a subclass of the default implementation, Drill.Core.DrillChuckDependencyResolver that provides the same behavior but adds support for resolving System.Web.HttpContextBase by intercepting calls that request that type and provides an alternate resolution mechanism. The AspNetDrillChuckDependencyResolver class is provided in the Drill.Integration.Web NuGet package and may be used with traditional ASP.NET applications as well as ASP.NET MVC applications.

Last edited Nov 24, 2012 at 3:47 PM by wreynolds, version 5


No comments yet.