Page 1 of 1

Error when adding parameter to command in IDbCommandInterceptor.ReaderExecuting

Posted: Wed 07 Aug 2013 06:58
by PavelTr
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?

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

Posted: Mon 12 Aug 2013 11:47
by Shalex
We have reproduced the issue and are investigating it.

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

Posted: Mon 19 Aug 2013 11:22
by Shalex
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.

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

Posted: Fri 06 Sep 2013 08:19
by Shalex
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.