title: Accessing data with DAL2: Value cannot be null.Parameter name: con
body: <p>I'm trying to access data with DAL2 in DotNetNuke. When I use the repository.Get() to get all fields of a certain table I sometimes get this error:</p>
  
  <p>'Value cannot be null. Parameter name: con'</p>
  
  <pre><code>public IEnumerable&lt;SitesProvince&gt; GetAll()
  {
       using (var ctx = DataContextContent.Instance())
       {
            var rep = ctx.GetRepository&lt;SitesProvince&gt;();
            return rep.Get();
       }
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>[TableName("Sites_Province")]
  [PrimaryKey("Sites_Province_No")]
  [Cacheable("Sites_Province", CacheItemPriority.Default, 20)]
  [Scope("Sites_Province_No")]
  public class SitesProvince
  {
      public int Sites_Province_No { get; set; }
      public string BU { get; set; }
      public string Province { get; set; }
  }
  </code></pre>
  
  <p>What could be the problem? In some queries it works and some don't and I don't see any difference between the methods.</p>
  
  <p>I found this but I have no contracts:
  <a href="http://clraddins.codeplex.com/discussions/24568">http://clraddins.codeplex.com/discussions/24568</a></p>