Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
PavelTr
Posts: 5
Joined: Thu 13 Jun 2013 10:42

Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Post by PavelTr » Wed 07 Aug 2013 06:58

I tried to use IDbCommandInterceptor (https://entityframework.codeplex.com/wi ... terception).
I wanted to change the command

public void ReaderExecuting(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext)
{
command.CommandText = command.CommandText + " OR Extent1.BookId = :p1";
var parameter = command.CreateParameter();
parameter.ParameterName = "p1";
parameter.DbType = DbType.Int64;
parameter.Value = 2;
command.Parameters.Add(parameter);
}

And it throw exception
Object reference not set to an instance of an object

I think it is because the parameter in command.Parameters has a type Devart.Data.Oracle.Entity.m (internal class), and the parameter type from command.CreateParameter() is Devart.Data.Oracle.OracleParameter?

How can i add a parameter to a command?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Post by Shalex » Mon 12 Aug 2013 11:47

We have reproduced the issue and are investigating it.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Post by Shalex » Mon 19 Aug 2013 11:22

The bug with generating NRE when adding parameter to a command in IDbCommandInterceptor.ReaderExecuting in Entity Framework 6 is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Post by Shalex » Fri 06 Sep 2013 08:19

New version of dotConnect for Oracle 7.9 is released!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=27875.

Post Reply