markrendle/Simple.Data — Issue #144: Query on dbo.SchemaTable table fails
Author: richardhopton
Created: 2012-01-31 22:55:42+00:00
State: open

[Test]
public void TestFindAllByIdWithSchemaQualification()
{
var db = DatabaseHelper.Open();
var dboCount = db.dbo.SchemaTable.FindAllById(1).ToList().Count;
var testCount = db.test.SchemaTable.FindAllById(1).ToList().Count;
Assert.AreEqual(1, dboCount);
Assert.AreEqual(0, testCount);
}

Fails with the following exception...

System.InvalidOperationException : Sequence contains more than one element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
Schema\TableCollection.cs(94,0): at Simple.Data.Ado.Schema.TableCollection.FindTableWithName(String tableName)
Schema\TableCollection.cs(33,0): at Simple.Data.Ado.Schema.TableCollection.Find(String tableName)
Schema\DatabaseSchema.cs(48,0): at Simple.Data.Ado.Schema.DatabaseSchema.FindTable(String tableName)
SimpleReferenceFormatter.cs(130,0): at Simple.Data.Ado.SimpleReferenceFormatter.TryFormatAsObjectReference(ObjectReference objectReference, Boolean excludeAlias)
SimpleReferenceFormatter.cs(32,0): at Simple.Data.Ado.SimpleReferenceFormatter.FormatColumnClause(SimpleReference reference, Boolean excludeAlias)
SimpleReferenceFormatter.cs(22,0): at Simple.Data.Ado.SimpleReferenceFormatter.FormatColumnClause(SimpleReference reference)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.String.Join(String separator, IEnumerable`1 values)
QueryBuilder.cs(286,0): at Simple.Data.Ado.QueryBuilder.GetColumnsClause(Table table)
QueryBuilder.cs(274,0): at Simple.Data.Ado.QueryBuilder.GetSelectClause(ObjectName tableName)
QueryBuilder.cs(84,0): at Simple.Data.Ado.QueryBuilder.SetQueryContext(SimpleQuery query)
QueryBuilder.cs(43,0): at Simple.Data.Ado.QueryBuilder.Build(SimpleQuery query, IEnumerable`1& unhandledClauses)
AdoAdapterQueryRunner.cs(160,0): at Simple.Data.Ado.AdoAdapterQueryRunner.GetQueryCommandBuilders(SimpleQuery query, IEnumerable`1& unhandledClauses)
AdoAdapterQueryRunner.cs(25,0): at Simple.Data.Ado.AdoAdapterQueryRunner.RunQuery(SimpleQuery query, IEnumerable`1& unhandledClauses)
AdoAdapter.cs(270,0): at Simple.Data.Ado.AdoAdapter.RunQuery(SimpleQuery query, IEnumerable`1& unhandledClauses)
SimpleQuery.cs(225,0): at Simple.Data.SimpleQuery.Run()
SimpleQuery.cs(475,0): at Simple.Data.SimpleQuery.ToList()
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)