AppBuilderExtensions.CreatePerOwinContext<T> Method (IAppBuilder, Func<IdentityFactoryOptions<T>, IOwinContext, T>)

Registers a callback that will be invoked to create an instance of type T that will be stored in the OwinContext which can fetch via context.Get.

Namespace:  Owin
Assembly:  Microsoft.AspNet.Identity.Owin (in Microsoft.AspNet.Identity.Owin.dll)


<ExtensionAttribute> _
Public Shared Function CreatePerOwinContext(Of T As {Class, IDisposable}) ( _
    app As IAppBuilder, _
    createCallback As Func(Of IdentityFactoryOptions(Of T), IOwinContext, T) _
) As IAppBuilder
Dim app As IAppBuilder 
Dim createCallback As Func(Of IdentityFactoryOptions(Of T), IOwinContext, T)
Dim returnValue As IAppBuilder 

returnValue = app.CreatePerOwinContext(createCallback)
public static IAppBuilder CreatePerOwinContext<T>(
    this IAppBuilder app,
    Func<IdentityFactoryOptions<T>, IOwinContext, T> createCallback
where T : class, IDisposable
generic<typename T>
where T : ref class, IDisposable 
static IAppBuilder^ CreatePerOwinContext(
    IAppBuilder^ app, 
    Func<IdentityFactoryOptions<T>^, IOwinContext^, T>^ createCallback
static member CreatePerOwinContext : 
        app:IAppBuilder * 
        createCallback:Func<IdentityFactoryOptions<'T>, IOwinContext, 'T> -> IAppBuilder   when 'T : not struct and IDisposable
JScript does not support generic types and methods.

Type Parameters

  • T
    The type of the context.


  • app
    Type: IAppBuilder
    The application builder.

Return Value

Type: IAppBuilder
The updated IAppBuilder.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAppBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see or

See Also


AppBuilderExtensions Class

CreatePerOwinContext Overload

Owin Namespace

Other Resources

ASP.NET Identity