<p>I am trying to inherit from my generated datacontext in LinqToSQL - something like this </p>

<pre><code>public class myContext : dbDataContext {
 public System.Data.Linq.Table&lt;User&gt;() Users {
  return (from x in base.Users() where x.DeletedOn.HasValue == false select x);
 }
}
</code></pre>

<p>But my Linq statement returns IQueryable which cannot cast to Table - does anyone know a way to limit the contents of a Linq.Table - I am trying to be certain that anywhere my Users table is accessed, it doesn't return those marked deleted. Perhaps I am going about this all wrong - any suggestions would be greatly appreciated.</p>

<p>Hal</p>

You could use discriminator column inheritance on the table, ie. a DeletedUsers table and ActiveUsers table where the discriminator column says which goes to which.  Then in your code, just reference the Users.OfType ActiveUsers, which will never include anything deleted.
As a side note, how the heck do you do this with markdown?
```
```
Users.OfType<ActiveUsers>
```
```
I can get it in code, but not inline