stkxchng
stkxchng

Reputation: 95

Dapper.contrib Insert - Cannot apply indexing with [] to an expression of type 'object'

Using:
.NET Core 1.1
Dapper.Contrib
Npgsql

On Postgresql 9.6

I am trying to use .InsertAsync extension method but getting error:
Cannot apply indexing with [] to an expression of type 'object'

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot apply indexing with [] to an expression of type 'object'
   at CallSite.Target(Closure , CallSite , Object , String )
   at CallSite.Target(Closure , CallSite , Object , String )
   at PostgresAdapter.<InsertAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

If I use normal .Insert method, everything works OK.
What could be the cause?

Upvotes: 0

Views: 274

Answers (1)

Owen Pauling
Owen Pauling

Reputation: 11871

This is a bug: https://github.com/StackExchange/Dapper/pull/689

Which, looking at the issue tracker, is fixed but unreleased.

You could try building from the latest source, or applying just that particular fix yourself.

Upvotes: 1

Related Questions