Invalid SQL statement when using FromSql
Posted: Thu 13 Apr 2017 17:35
When using efcore 1.0.1 and dotconnect 9.2.187 the generated SQL from using FromSql followed by an include generates a table alias for the subquery using the keyword AS. Take for example:
sql:
"select * from search where id in ({0}, {1})"
this.context.SEARCH.FromSql(sql, 1,2).Include(search => search.person);
generates the following sql:
SELECT "c".ID, "c".DATE, "c0".ID, "c0".NAME,
FROM (
select * from search where id in ({0}, {1})
) AS "c"
LEFT JOIN PERSON "c0" ON "c".ID = "c0".ID
not exact tables/sql for brevity but example is valid.
Would an upgrade to a newer version of devart solve the problem or is this a bug?
sql:
"select * from search where id in ({0}, {1})"
this.context.SEARCH.FromSql(sql, 1,2).Include(search => search.person);
generates the following sql:
SELECT "c".ID, "c".DATE, "c0".ID, "c0".NAME,
FROM (
select * from search where id in ({0}, {1})
) AS "c"
LEFT JOIN PERSON "c0" ON "c".ID = "c0".ID
not exact tables/sql for brevity but example is valid.
Would an upgrade to a newer version of devart solve the problem or is this a bug?