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.
Literal in select query instead of bind variables
Re: Literal in select query instead of bind variables
Please try the following query:
It will generate:
Code: Select all
int a = 1;
var books = Context.Books
.Where(b => b.BookId == a)
.ToList();
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)