{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6010","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6010/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6010/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6010/events","html_url":"https://github.com/aspnet/EntityFramework/issues/6010","id":164259578,"number":6010,"title":"Mapping  table valued function with entity framework code first","user":{"login":"jayanthakgjls","id":3367072,"avatar_url":"https://avatars1.githubusercontent.com/u/3367072?v=3","gravatar_id":"","url":"https://api.github.com/users/jayanthakgjls","html_url":"https://github.com/jayanthakgjls","followers_url":"https://api.github.com/users/jayanthakgjls/followers","following_url":"https://api.github.com/users/jayanthakgjls/following{/other_user}","gists_url":"https://api.github.com/users/jayanthakgjls/gists{/gist_id}","starred_url":"https://api.github.com/users/jayanthakgjls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayanthakgjls/subscriptions","organizations_url":"https://api.github.com/users/jayanthakgjls/orgs","repos_url":"https://api.github.com/users/jayanthakgjls/repos","events_url":"https://api.github.com/users/jayanthakgjls/events{/privacy}","received_events_url":"https://api.github.com/users/jayanthakgjls/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-07T08:50:00Z","updated_at":"2017-05-03T19:04:07Z","closed_at":"2016-07-07T08:58:58Z","body":"I'm trying to execute a table valued function and get a list of entities .\n\n```\n[DbFunction(\"APIDBContext\", \"GetMyEntities\")]\npublic virtual IQueryable<MyEntity> GetMyEntities(Nullable<int> userId)\n            {\n      return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<MyEntity>(string.Format(\"[{0}].{1}\", GetType().Name,\n                        \"[GetMyEntities](@userId)\"), userIdParameter).AsQueryable();\n\n    }\n```\n\nSeems like it I need to have same names for the columns i'm returning from the database even though I have specified column mappings in the model builder.\n\nI'm getting the exception\n\n`Invalid column name 'MyColumn'`\n\nBut I have mapped this column in the model builder ,\n`Property(e => e.MyColumn).HasColumnName(\"My_Column\");`\n\nIs this not supported yet in entity framework code first ?\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/299005205","html_url":"https://github.com/aspnet/EntityFramework/issues/6010#issuecomment-299005205","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6010","id":299005205,"user":{"login":"divega","id":1253414,"avatar_url":"https://avatars3.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":"2017-05-03T19:04:07Z","updated_at":"2017-05-03T19:04:07Z","body":"@bogatykh the only way to use TVFs currently in EF Core is to write a SQL query that performs a SELECT and pass it to the `FromSql()` method:\r\n\r\n``` C#\r\nvar q = context.Products.FromSql(\"SELECT * FROM MyTVF({0}), argument);\r\n```\r\n\r\nThere is no first class support for mapping a TVF in the model. That said, SELECT queries passed to `FromSql()` are composable using LINQ and at execution they go through the same mapping as any other queries, e.g. the TVF needs to have the same column names as the corresponding table in the model.\r\n\r\nSo, I guess you can say that this issue does not exist in EF Core."}}
{"actor":{"display_login":"divega"}}