markrendle/Simple.Data — Issue #147: BulkInserter doesn't support objects with columns not in underlying table
Author: richardhopton
Created: 2012-02-03 00:14:02+00:00
State: open

To reproduce remove the Export attribute from SqlBulkInserter and run the CanFetchMoreThanOneHundredRows in SqlTest.QueryTest and it will fail with the following exception - seems like it's looking for the "Orders" column which is not present so cannot be found.

Test 'Simple.Data.SqlTest.QueryTest.CanFetchMoreThanOneHundredRows' failed: Simple.Data.UnresolvableObjectException : Column not found
----> Simple.Data.UnresolvableObjectException : Exception of type 'Simple.Data.UnresolvableObjectException' was thrown.
Schema\Table.cs(91,0): at Simple.Data.Ado.Schema.Table.FindColumn(String columnName)
BulkInserterHelper.cs(183,0): at Simple.Data.Ado.BulkInserterHelper.BuildParameterSettingAction(IDictionary`2 sample)
BulkInserterHelper.cs(95,0): at Simple.Data.Ado.BulkInserterHelper.InsertRow(IDictionary`2 row, IDbCommand command, Func`3 onError)
BulkInserterHelper.cs(38,0): at Simple.Data.Ado.BulkInserterHelper.InsertRowsWithoutFetchBack(String insertSql, Func`3 onError)
BulkInserter.cs(38,0): at Simple.Data.Ado.BulkInserter.Insert(AdoAdapter adapter, String tableName, IEnumerable`1 data, IDbTransaction transaction, Func`3 onError, Boolean resultRequired)
AdoAdapterInserter.cs(39,0): at Simple.Data.Ado.AdoAdapterInserter.InsertMany(String tableName, IEnumerable`1 data, Func`3 onError, Boolean resultRequired)
AdoAdapter.cs(310,0): at Simple.Data.Ado.AdoAdapter.InsertMany(String tableName, IEnumerable`1 data, Func`3 onError, Boolean resultRequired)
Database.cs(119,0): at Simple.Data.Database.Insert(String tableName, IEnumerable`1 data, ErrorCallback onError, Boolean resultRequired)
Commands\InsertCommand.cs(85,0): at Simple.Data.Commands.InsertCommand.InsertEntity(Object entity, DataStrategy dataStrategy, String tableName, ErrorCallback onError, Boolean resultRequired)
Commands\InsertCommand.cs(41,0): at Simple.Data.Commands.InsertCommand.DoInsert(InvokeMemberBinder binder, Object[] args, DataStrategy dataStrategy, String tableName)
Commands\InsertCommand.cs(21,0): at Simple.Data.Commands.InsertCommand.Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, Object[] args)
DynamicTable.cs(93,0): at Simple.Data.DynamicTable.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
ObjectReference.cs(108,0): at Simple.Data.ObjectReference.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
at CallSite.Target(Closure , CallSite , Object , Customer[] )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
D:\Projects\CSharp\Simple.Data\master\Simple.Data\Simple.Data.SqlTest\QueryTest.cs(388,0): at Simple.Data.SqlTest.QueryTest.CanFetchMoreThanOneHundredRows()
--UnresolvableObjectException
Schema\ColumnCollection.cs(29,0): at Simple.Data.Ado.Schema.ColumnCollection.Find(String columnName)
Schema\Table.cs(87,0): at Simple.Data.Ado.Schema.Table.FindColumn(String columnName)

0 passed, 1 failed, 0 skipped, took 12.76 seconds (NUnit 2.5.5).