public void CommandTimeoutTests([IncludeDataSources(false, TestProvName.AllSqlServer)] string context) { using (var db = new TestDataContext(context)) { db.KeepConnectionAlive = true; db.CommandTimeout = 10; Assert.Null(db.DataConnection); db.GetTable <Person>().ToList(); Assert.NotNull(db.DataConnection); Assert.That(db.DataConnection !.CommandTimeout, Is.EqualTo(10)); db.CommandTimeout = -10; Assert.That(db.DataConnection.CommandTimeout, Is.EqualTo(-1)); db.CommandTimeout = 11; var record = db.GetTable <Child>().First(); Assert.That(db.DataConnection !.CommandTimeout, Is.EqualTo(11)); } }
public T GetById(int id) { T t = dataContext.GetTable <T>().SingleOrDefault(elem => elem.Id.Equals(id)); return(t); }