Owin. How can I get current App context?

0
=
0
+
0
No specific Bitcoin Bounty has been announced by author. Still, anyone could send Bitcoin Tips to those who provide a good answer.
0

Hello :)

For example.

Startup project: I configure and create Owin App.

Core project: This project is core. In this project, all the magic happens.

But! I want to configure DB connection for Core project in Startup project and have these settings in classes of a Core project project.

I believe that it should be done like this:

class Strartup
{
    public void Configuration(IAppBuilder app)
    {
        app.Properties.Add("ConnectionString", "SomeString");
    }
}

class SomeClass
{
    // And getting this string in the other classes
    public void SomeMethod()
    {
        string connectionString = SomeObject.GetContext().Properties.Get("ConnectionString");
    }
}
User rating:

Try to use Request.GetOwinContext(). GetOwinContext() is extension for HttpRequestMessage.

User rating:

Ok. Thanks))

0 answers

0
=
0
=
$0
Internet users could send Bitcoin Tips to you if they like your answer!

Too many commands? Learning new syntax?

FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your productivity with FavScripts.com!

Post Answer