AppBuilderExtensions.CreatePerOwinContext<T> Method (IAppBuilder, Func<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)

Syntax

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

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

Type Parameters

  • T
    The type of the context.

Parameters

  • app
    Type: IAppBuilder
    The IAppBuilder passed to the configuration method.
  • createCallback
    Type: System.Func<T>
    The callback function that is invoked to create an instance of T.

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

See Also

Reference

AppBuilderExtensions Class

CreatePerOwinContext Overload

Owin Namespace

Other Resources

ASP.NET Identity