{"action":"opened","issue":{"url":"https://api.github.com/repos/moozzyk/CodeFirstFunctions/issues/29","repository_url":"https://api.github.com/repos/moozzyk/CodeFirstFunctions","labels_url":"https://api.github.com/repos/moozzyk/CodeFirstFunctions/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/moozzyk/CodeFirstFunctions/issues/29/comments","events_url":"https://api.github.com/repos/moozzyk/CodeFirstFunctions/issues/29/events","html_url":"https://github.com/moozzyk/CodeFirstFunctions/issues/29","id":354391819,"node_id":"MDU6SXNzdWUzNTQzOTE4MTk=","number":29,"title":"Paramter Type is not right.","user":{"login":"jonantoine","id":2699833,"node_id":"MDQ6VXNlcjI2OTk4MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/2699833?v=4","gravatar_id":"","url":"https://api.github.com/users/jonantoine","html_url":"https://github.com/jonantoine","followers_url":"https://api.github.com/users/jonantoine/followers","following_url":"https://api.github.com/users/jonantoine/following{/other_user}","gists_url":"https://api.github.com/users/jonantoine/gists{/gist_id}","starred_url":"https://api.github.com/users/jonantoine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonantoine/subscriptions","organizations_url":"https://api.github.com/users/jonantoine/orgs","repos_url":"https://api.github.com/users/jonantoine/repos","events_url":"https://api.github.com/users/jonantoine/events{/privacy}","received_events_url":"https://api.github.com/users/jonantoine/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-27T16:42:51Z","updated_at":"2018-08-27T16:42:51Z","closed_at":null,"author_association":"NONE","body":"I have a very simple example to demonstrate this issue.\r\n\r\nI have a Table Valued Function:\r\n\r\n    CREATE FUNCTION [dbo].[TestTVF]\r\n    (\t\r\n\t    @param1 varchar(max)\r\n    )\r\n    RETURNS TABLE \r\n    AS\r\n    RETURN \r\n    (\r\n        SELECT 1 as Id, 'Test' as [Name]\r\n    )\r\n\r\nAnd I have the DbFunction\r\n\r\n    [DbFunction(\"DB\", \"TestTVF\")]\r\n    public IQueryable<TestTvfResult> TestTVF([ParameterType(StoreType = \"varchar(max)\")] string param1)\r\n    {\r\n        var p1 = param1 != null ?\r\n            new ObjectParameter(\"param1\", param1) :\r\n            new ObjectParameter(\"param1\", typeof(string));\r\n\r\n        return ((IObjectContextAdapter)this).ObjectContext.\r\n        CreateQuery<TestTvfResult>(\"[DB].[TestTVF](@param1)\", p1);\r\n    }\r\n\r\nBut when I use the function the sql generate is this:\r\n\r\n    exec sp_executesql N'SELECT \r\n    1 AS [C1], \r\n    [Extent1].[Id] AS [Id], \r\n    [Extent1].[Name] AS [Name]\r\n    FROM [dbo].[TestTVF](@param1) AS [Extent1]',N'@param1 nvarchar(4000)',@param1=N'test'\r\n\r\n**Expected:** use varchar(max) and not nvarchar(4000)"}}
{"actor":{"display_login":"jonantoine"}}