3 using System.Collections.Generic;
5 using System.Linq.Expressions;
9 namespace Deveel.Data.Linq {
10 public sealed
class QueryTable<T> : IQueryable<T> where T : class {
17 private IEntityTable<T> EntityTable {
21 IEnumerator<T> IEnumerable<T>.GetEnumerator() {
22 return EntityTable.GetEnumerator();
25 IEnumerator IEnumerable.GetEnumerator() {
26 return EntityTable.GetEnumerator();
29 Expression IQueryable.Expression {
30 get {
return EntityTable.Expression; }
33 Type IQueryable.ElementType {
34 get {
return EntityTable.ElementType; }
37 IQueryProvider IQueryable.Provider {
38 get {
return EntityTable.Provider; }
42 return EntityTable.Delete(entity);
47 throw new ArgumentNullException(
"id");
50 return EntityTable.GetById(
id);
51 }
catch (Exception ex) {
52 throw new QueryException(String.Format(
"Error while querying type '{0}' by id.", typeof(T)), ex);
57 return EntityTable.Update(entity);
60 public int Add(T entity) {
61 return EntityTable.Insert(entity);
QueryTable(QueryContext context)