{"action":"created","issue":{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/41","labels_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/41/comments","events_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/41/events","html_url":"https://github.com/OpenRIAServices/TestIssues/issues/41","id":127332331,"number":41,"title":"Allow Task-Async Query and Invoke on Server","user":{"login":"STAH","id":2418242,"avatar_url":"https://avatars.githubusercontent.com/u/2418242?v=3","gravatar_id":"","url":"https://api.github.com/users/STAH","html_url":"https://github.com/STAH","followers_url":"https://api.github.com/users/STAH/followers","following_url":"https://api.github.com/users/STAH/following{/other_user}","gists_url":"https://api.github.com/users/STAH/gists{/gist_id}","starred_url":"https://api.github.com/users/STAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STAH/subscriptions","organizations_url":"https://api.github.com/users/STAH/orgs","repos_url":"https://api.github.com/users/STAH/repos","events_url":"https://api.github.com/users/STAH/events{/privacy}","received_events_url":"https://api.github.com/users/STAH/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/labels/CodePlex","name":"CodePlex","color":"ededed"},{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-18T23:41:26Z","updated_at":"2016-01-18T23:41:26Z","closed_at":null,"body":"<sub>This issue was imported from [CodePlex](http://openriaservices.codeplex.com/workitem/41)</sub>\r\n\r\n**[danneesset](https://github.com/danneesset)** <sup>wrote 2014-05-07 at 21:54</sup>\r\nAdd support for Task-Async Queries and Invoke methods and make sure that AggregateException are properly handled by Ria Services (by sending the inner exception to the client).\r\n\r\n\r\nWhy:\r\n\r\n- In a future release it will be possible to support a fully asynchronous pipeline in order to achive much better scalability.\r\n- Writing service methods which in turn use many task-async methods becomes easier since one can now use async/await in the service methods and return a Task.\r\n\r\nThis is the current pattern in order to be able to utilize async/await for service methods\r\n\r\n```\r\npublic IQueryable<Product> GetProductsByCategory(Category category)\n{\n try\n {\n   // Start executing the \"async\" method\n   return GetProductsByCategoryAsync(category).Result;\n }\n Catch (AggregateException ae)\n {\n    // AggregateException is not handled today so we must \"unwrap\" it, unfortunately this will destroy the stack trace\n    throw ar.Flatten().InnerException;\n }\n}\n\nprivate async Task<IQueryable<Product>> GetProductsByCategoryAsync(Category category)\n{\n....\n}\r\n```\r\nIt should be sufficient to write this instead:\r\n\r\n```\r\npublic async Task<IQueryable<Product>> GetProductsByCategory(Category category)\n{\n....\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/comments/172683108","html_url":"https://github.com/OpenRIAServices/TestIssues/issues/41#issuecomment-172683108","issue_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/41","id":172683108,"user":{"login":"STAH","id":2418242,"avatar_url":"https://avatars.githubusercontent.com/u/2418242?v=3","gravatar_id":"","url":"https://api.github.com/users/STAH","html_url":"https://github.com/STAH","followers_url":"https://api.github.com/users/STAH/followers","following_url":"https://api.github.com/users/STAH/following{/other_user}","gists_url":"https://api.github.com/users/STAH/gists{/gist_id}","starred_url":"https://api.github.com/users/STAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STAH/subscriptions","organizations_url":"https://api.github.com/users/STAH/orgs","repos_url":"https://api.github.com/users/STAH/repos","events_url":"https://api.github.com/users/STAH/events{/privacy}","received_events_url":"https://api.github.com/users/STAH/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T23:41:26Z","updated_at":"2016-01-18T23:41:26Z","body":"**[danneesset](https://github.com/danneesset)** <sup>wrote 2014-05-07 at 22:39</sup>\r\nThe pull request can be found at [https://openriaservices.codeplex.com/SourceControl/network/forks/danneesset/openriaservices/contribution/6747](https://openriaservices.codeplex.com/SourceControl/network/forks/danneesset/openriaservices/contribution/6747)\r\n"}}