markrendle/Simple.Data — Issue #133: UnresolvableObjectException when using schema qualified query
Author: achaltn
Created: 2011-12-15 22:38:28+00:00
State: open

I stumbled across this exception when trying to map columns to DTO-properties using aliases:

### Works:
```c#
var result = db.TestSchema.TestTable.FindByKey(key);
```

### Works, as long as my custom provider returns `TestSchema` as default schema:
```c#
var result = db.TestTable.QueryByKey(key)
.Select(db.TestTable.Key.As("Id"), db.TestTable.Value.As("Whatever"))
.Single();
```

### *Fails:*
```c#
var result = db.TestSchema.TestTable.QueryByKey(key)
.Select(db.TestSchema.TestTable.Key.As("Id"), db.TestTable.TestSchema.Value.As("Whatever"))
.Single();
```

### Error message:

Test method I5Test.Tests.Repositories.I5TranslationRepository.GetByKey threw exception:
Simple.Data.UnresolvableObjectException: No matching table found, or insufficient permissions.

### Exception.ObjectName:

.TestSchema

### Stack trace:

Simple.Data.Ado.Schema.TableCollection.Find(String tableName, String schemaName)
Simple.Data.Ado.Schema.TableCollection.Find(ObjectName tableName)
Simple.Data.Ado.Schema.DatabaseSchema.FindTable(ObjectName tableName)
Simple.Data.Ado.Joiner.<>c__DisplayClass15.b__12(ObjectName _)
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
Simple.Data.Ado.Joiner.AddJoin(ObjectName table1Name, ObjectName table2Name, JoinType joinType)
Simple.Data.Ado.Joiner.GetJoinClauses(ObjectName mainTableName, IEnumerable`1 tableList, JoinType joinType)
Simple.Data.Ado.QueryBuilder.HandleJoins()
Simple.Data.Ado.QueryBuilder.Build(SimpleQuery query, IEnumerable`1& unhandledClauses)
Simple.Data.Ado.AdoAdapter.GetQueryCommandBuilders(SimpleQuery query, IEnumerable`1& unhandledClauses)
Simple.Data.Ado.AdoAdapter.RunQuery(SimpleQuery query, IEnumerable`1& unhandledClauses)
Simple.Data.SimpleQuery.Run()
Simple.Data.SimpleQuery.Single()
System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)