title: Sequence contains no elements Linq-to-Sql
body: <p>I'm having very strange problem in this simple linq query</p>
  
  <pre><code>return (from doc in db.umDocumentActions
                      where doc.sysDocument.ModuleID == modid
                      join roleaction in db.umRoleActions on doc.DocumentActionID equals roleaction.DocumentActionID
                      where roleaction.RoleID == roleID
                      select new { doc.DocumentID, roleaction.RoleID }).Count() &gt; 0;
  </code></pre>
  
  <p>When this query is called it gives invalid operation exception telling me that sequence contains no elements. It happens when there is fair amount of traffic on the site. I am using following static method to get instance of datacontext.</p>
  
  <pre><code>public static EvoletDataContext Get() 
          {
              var connection = ProfiledDbConnection.Get(new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ToString()));
  
              return new EvoletDataContext(connection);
              //return DataContextUtils.CreateDataContext&lt;EvoletDataContext&gt;(connection);
          }
  </code></pre>
  
  <p>I'm afraid that this method is creating problem as static methods are not thread safe. Any views?</p>