Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "Cannot resolve symbol 'CreatePerOwinContext'"?

I have a self hosted owin Web Api and I'm trying to use a single instance of my EF Context per Owin Request. Here is my config code for the startup class.

public void Configuration(IAppBuilder app)
{         
    app.CreatePerOwinContext(A3Context.Create);
}

This won't build because I get the following error.

Error

5 'Owin.IAppBuilder' does not contain a definition for 'CreatePerOwinContext' and no extension method 'CreatePerOwinContext' accepting a first argument of type 'Owin.IAppBuilder' could be found (are you missing a using directive or an assembly reference?)

I'm I missing a reference that I'm not aware of?

like image 768
Brett Feagans Avatar asked Jan 02 '15 01:01

Brett Feagans


1 Answers

CreatePerOwinContext is an extension method in the Microsoft.AspNet.Identity.Owin NuGet package.

To resolve, open package manager console for your project and install with the following command:

Install-Package Microsoft.AspNet.Identity.Owin

Ensure you are referencing the namespace containing the extension method:

using Owin;
like image 56
cchamberlain Avatar answered Sep 21 '22 07:09

cchamberlain