This project is read-only.

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"?>
<configuration>
	<configSections>
		<sectionGroup name="drill">
			<section name="dependencyResolvers" type="Drill.Configuration.ConfigFile.DependencyResolversConfigurationSection, Drill" />
		</sectionGroup>
	</configSections>
	<drill>
		<dependencyResolvers>
			<dependencyResolver name="MyResolver" type="Drill.Integration.Web.AspNetDrillChuckDependencyResolver, Drill.Integration.Web">
				<drillBits>
					<drillBit name="MyUnityContainer" type="Drill.DrillBits.Unity.UnityDrillBit, Drill.DrillBits.Unity">
						<cfgSources>
							<cfgSource key="UnityConfigSectionAppConfig" method="ConfigFile" />
						</cfgSources>
					</drillBit>
				</drillBits>
			</dependencyResolver>
		</dependencyResolvers>
	</drill>
</configuration>

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 4:47 PM by wreynolds, version 5

Comments

No comments yet.