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");
    }
}

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

Ok. Thanks))

0 answers - total earned - 0 BTC ($0 USD)

0
=
0
=
$0
Everyone, even non-registered users could send Bitcoin Tips to YOU if they are inspired by your answer!

Post Answer


Will Bitcoin Tipping become a new Internet Culture?


Please share our story! THANK YOU!