using System; using System.Linq.Expressions; namespace BLToolkit.Data { using Linq; public partial class DbManager : IDataContext { public Table GetTable() where T : class { return new Table(this); } public T Select(Expression> selector) { if (selector == null) throw new ArgumentNullException("selector"); var q = new Table(this, selector); foreach (var item in q) return item; throw new InvalidOperationException(); } /// /// Compiles the query. /// /// /// A generic delegate that represents the compiled query. /// /// /// The query expression to be compiled. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Returned type of the delegate returned by the method. /// public Func Compile( [JetBrains.Annotations.NotNull] Expression> query) where TDb : DbManager { return CompiledQuery.Compile(query); } /// /// Compiles the query. /// /// /// A generic delegate that represents the compiled query. /// /// /// The query expression to be compiled. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Returned type of the delegate returned by the method. /// public Func Compile( [JetBrains.Annotations.NotNull] Expression> query) where TDb : DbManager { return CompiledQuery.Compile(query); } /// /// Compiles the query. /// /// /// A generic delegate that represents the compiled query. /// /// /// The query expression to be compiled. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Returned type of the delegate returned by the method. /// public Func Compile( [JetBrains.Annotations.NotNull] Expression> query) where TDb : DbManager { return CompiledQuery.Compile(query); } /// /// Compiles the query. /// /// /// A generic delegate that represents the compiled query. /// /// /// The query expression to be compiled. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Represents the type of the parameter that has to be passed in when executing the delegate returned by the method. /// /// /// Returned type of the delegate returned by the method. /// public Func Compile( [JetBrains.Annotations.NotNull] Expression> query) where TDb : DbManager { return CompiledQuery.Compile(query); } } }