I went through many links but couldn't find my answer.Links such as Global variables for setting configurations ASP.NET MVC , ASP.NET MVC C# global variable, ASP.NET MVC Global Variables and many more all of them suggest some complex methods like using Application_Start or using session variables, singleton pattern. But I don't want to use these, I just want declare a variable in a certain file and access it anywhere I need.
var dataContext = new PetaPoco.Database("MessageEntity");
This line is required anywhere I need to access the database. So I want to declare this dataContext as global variable in a certain different file and access it on my several other controllers. How would I accomplish this. Please help!!