Search code examples
c#oraclelinqpad

oracle insert / delete problems in linqpad


excuse me if this question already popped up, I haven't found it.

I have a very simple oracle table (11g express if it matters):

desc exch_rate;
Name                           Null   Typ                                                                                                                                                                                           
------------------------------ -------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
FROM_CURRENCY                           VARCHAR2(3)                                                                                                                                                                                   
TO_CURRENCY                             VARCHAR2(3)                                                                                                                                                                                   
EXCH_DATE                               DATE                                                                                                                                                                                          
EX_RATE                                 NUMBER(4)                                                                                                                                                                                         
ID                             NOT NULL NUMBER                                                                                                                                                                                        

5 rows selected

I'm trying to delete contents of this table with linqpad, so the code is usual combination of ExchRates.DeleteOnSubmit(row) and SubmitChanges(); at the end.

but instead of getting empty table I'm getting an error:

InvalidOperationException  
Sequence contains no elements 

   at System.Linq.Enumerable.Aggregate[TSource](IEnumerable`1 source, Func`3 func)
   at IQToolkit.Data.Common.BasicMapper.GetIdentityCheck(Expression root, MappingEntity entity, Expression instance)
   at IQToolkit.Data.Common.BasicMapper.GetDeleteExpression(MappingEntity entity, Expression instance, LambdaExpression deleteCheck)
   at IQToolkit.Data.Common.AdvancedMapper.GetDeleteExpression(MappingEntity entity, Expression instance, LambdaExpression deleteCheck)
   at IQToolkit.Data.Common.QueryBinder.BindDelete(IEntityTable upd, Expression instance, LambdaExpression deleteCheck)
   at IQToolkit.Data.Common.QueryBinder.VisitMethodCall(MethodCallExpression m)
   at IQToolkit.ExpressionVisitor.Visit(Expression exp)
   at IQToolkit.Data.Common.DbExpressionVisitor.Visit(Expression exp)
   at IQToolkit.Data.Common.QueryBinder.Visit(Expression exp)
   at IQToolkit.Data.Common.QueryBinder.Bind(QueryMapper mapper, Expression expression)
   at IQToolkit.Data.Common.QueryMapper.Translate(Expression expression)
   at IQToolkit.Data.Common.QueryTranslator.Translate(Expression expression)
   at IQToolkit.Data.EntityProvider.GetExecutionPlan(Expression expression)
   at IQToolkit.Data.EntityProvider.Execute(Expression expression)
   at IQToolkit.Updatable.Delete[T](IUpdatable`1 collection, T instance, Expression`1 deleteCheck)
   at IQToolkit.Updatable.Delete[T](IUpdatable`1 collection, T instance)
   at IQToolkit.Data.EntityProvider.EntityTable`1.Delete(T instance)
   at IQToolkit.Data.EntityProvider.EntityTable`1.IQToolkit.IEntityTable.Delete(Object instance)
   at IQToolkit.Data.EntitySession.TrackedTable`1.SubmitChanges(TrackedItem item)
   at IQToolkit.Data.EntitySession.TrackedTable`1.IQToolkit.Data.EntitySession.ITrackedTable.SubmitChanges(TrackedItem item)
   at IQToolkit.Data.EntitySession.<SubmitChanges>b__0()
   at IQToolkit.Data.DbEntityProvider.DoTransacted(Action action)
   at IQToolkit.Data.EntitySession.SubmitChanges()
   at IQDriver.IQContextBase.SubmitChanges()

I'm clueless here. I'm using the latest version of IQ driver (2.0.6.0) and version 4.42.01 of LinqPad. any idea what am I doing wrong? I would really like not to give up on LinqPad for the task ;)

Thanks, Michal


Solution

  • Is there a primary key on that table?

    Short of that, perhaps it's a bug in the IQ library. Have you tried deleting rows from other tables?