DependencyResolverExtensions.GetService<TService> Method

Resolves singly registered services that support arbitrary object creation.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public static TService GetService<TService>(
	this IDependencyResolver resolver

Type Parameters


The type of the requested service or object.


Type: System.Web.Mvc.IDependencyResolver
The dependency resolver instance that this method extends.

Return Value

Type: TService
The requested service or object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDependencyResolver. When you use instance method syntax to call this method, omit the first parameter. For more information, see b8020aae-374d-46a9-bcb7-8cc2390b93b6 or 175ce3ff-9bbf-4e64-8421-faeb81a0bb51.

For more information about this method, see the entry ASP.NET MVC 3 Service Location on Brad Wilson's blog.