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

TService

The type of the requested service or object.

Parameters

resolver
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 https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

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

Show: