You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to execute a simple query such as listing the names of the roles in a role table I can do this:
var sql = "SELECT r.name FROM com.role r";
return _ctx.Roles.AsNoTracking().FromSql(sql).Select(r => r.name).ToList();
Which will produce SQL like:
SELECT "r"."name"
FROM (
SELECT r.name FROM com.role r
) AS "r"
It would be nice if I could instead do something like this:
var sql = "SELECT r.name FROM com.role r";
return _ctx.FromSql<string>(sql).ToList();
so that the result set doesn't have to map to a type setup as a DbSet in the context. Is this possible or something you'd consider adding in some way?
The text was updated successfully, but these errors were encountered:
csaloio
changed the title
Possible to use FromSql() with a type that is not necessaily a DbSet?
Possible to use FromSql() with a type that is not necessarily a DbSet?
Feb 26, 2016
If I want to execute a simple query such as listing the names of the roles in a role table I can do this:
Which will produce SQL like:
It would be nice if I could instead do something like this:
so that the result set doesn't have to map to a type setup as a DbSet in the context. Is this possible or something you'd consider adding in some way?
The text was updated successfully, but these errors were encountered: