Is it a good idea to store my DataContext in Session Memory?
<p>I'm writing a pretty straightforward ASP.net project. It's using a Linq2Sql DataContext to access stored procedures. There's a IDisposable class that creates a new DataContext in it's constructor and disposes it in it's dispose.</p>

<p>Whenever possible I group together requests inside the:</p>

<pre><code>    using(var dc = new MyDataAccessClass())
    {
       //All the data requests in here
    }

    // Do stuff with the data here
</code></pre>

<p>So there are quite a few of these throughout the code mostly in the UserControls, and I was just thinking if it would make sense to Create a single DataAccess Class in the PageLoad of the starting page (Or the master page), store it in Session Memory, and reference in all the UserControls and whatnot, then dispose of it in the PreRender stage.</p>

<p>So here's my question, is this a bad idea? I imagine this would involve a few dangling connections to the database, as exceptions or debugging would stop the PreRender running.
Maybe a check on the MasterPage's Load to see if there's anything in that session Variable and to dispose it if it is, would sort it.</p>

<p>Or is there a smarter way to share a DataContext throughout the page life cycle without your DBA wanting to hit you with your keyboard?</p>
