{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2483","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2483/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2483/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2483/events","html_url":"https://github.com/aspnet/EntityFramework/issues/2483","id":91430078,"number":2483,"title":"[Question] SQLQuery","user":{"login":"XcoderTeam","id":1622986,"avatar_url":"https://avatars.githubusercontent.com/u/1622986?v=3","gravatar_id":"","url":"https://api.github.com/users/XcoderTeam","html_url":"https://github.com/XcoderTeam","followers_url":"https://api.github.com/users/XcoderTeam/followers","following_url":"https://api.github.com/users/XcoderTeam/following{/other_user}","gists_url":"https://api.github.com/users/XcoderTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/XcoderTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XcoderTeam/subscriptions","organizations_url":"https://api.github.com/users/XcoderTeam/orgs","repos_url":"https://api.github.com/users/XcoderTeam/repos","events_url":"https://api.github.com/users/XcoderTeam/events{/privacy}","received_events_url":"https://api.github.com/users/XcoderTeam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-27T07:55:33Z","updated_at":"2015-06-27T13:03:53Z","closed_at":null,"body":"What is the current alternative way to query raw sql?\r\nDatabase.SqlQuery - Not Exists"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/116041402","html_url":"https://github.com/aspnet/EntityFramework/issues/2483#issuecomment-116041402","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2483","id":116041402,"user":{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"created_at":"2015-06-27T13:03:53Z","updated_at":"2015-06-27T13:03:53Z","body":"You can do `context.Products.FromSql(\"select * from archive.products\")`. Compared to `Database.SqlQuery()` it is limited to queries that can be expressed in terms of entities, or that at least start with an entity (you can later project using LINQ and the projection will be executed on the server, e.g.: `context.Products.FromSql(\"select * from archive.products\").Select(p => new {p.Id, p.Name})`.\r\n\r\nDoes this work for you?"}}