Literal in select query instead of bind variables

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
PavelTr
Posts: 5
Joined: Thu 13 Jun 2013 10:42

Literal in select query instead of bind variables

Post by PavelTr » Mon 05 Aug 2013 15:13

I try simple linq query

var books = Context.Books
.Where(b => b.BookId == 1)
.ToList();

I see in dbmonitor that the sql is

SELECT
Extent1.BookId,
Extent1.Name_Rus,
Extent1.Name_Eng,
Extent1.Code_Rus,
Extent1.Code_Eng,
Extent1.AUTHOR
FROM Book Extent1
WHERE Extent1.BookId = 1

Why did not use the bind variable instead of literal in sql and how can i config devart to use bind variable in select query?

Thanks.

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

Re: Literal in select query instead of bind variables

Post by Shalex » Wed 07 Aug 2013 07:37

Please try the following query:

Code: Select all

int a = 1;
var books = Context.Books
.Where(b => b.BookId == a)
.ToList();
It will generate:

Code: Select all

SELECT
Extent1.BookId,
Extent1.Name_Rus,
Extent1.Name_Eng,
Extent1.Code_Rus,
Extent1.Code_Eng,
Extent1.AUTHOR
FROM Book Extent1
WHERE (Extent1.BookId = = :p__linq__0) AND (:p__linq__0 IS NOT NULL)

PavelTr
Posts: 5
Joined: Thu 13 Jun 2013 10:42

Re: Literal in select query instead of bind variables

Post by PavelTr » Wed 07 Aug 2013 08:30

Thanks.

Post Reply