Dbcontext in layout.cs

I would like to call a logo and a title from the db and display them in the mainlayout but when I call the method in the I load event of the layout the Dbcontext is always disposed.

I’m injecting the Dbcontext in the class as I do for all my pages but can’t figure out where I’m going wrong.

What am I missing?

We don't really know why the context might be disposed. You can try instantiating it whenever you use it instead of injecting it.