{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2249","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2249/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2249/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2249/events","html_url":"https://github.com/aspnet/EntityFramework/pull/2249","id":79190212,"number":2249,"title":"Fix to #2069 - Guid.NewGuid() returns same order every time","user":{"login":"maumar","id":1591930,"avatar_url":"https://avatars.githubusercontent.com/u/1591930?v=3","gravatar_id":"","url":"https://api.github.com/users/maumar","html_url":"https://github.com/maumar","followers_url":"https://api.github.com/users/maumar/followers","following_url":"https://api.github.com/users/maumar/following{/other_user}","gists_url":"https://api.github.com/users/maumar/gists{/gist_id}","starred_url":"https://api.github.com/users/maumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maumar/subscriptions","organizations_url":"https://api.github.com/users/maumar/orgs","repos_url":"https://api.github.com/users/maumar/repos","events_url":"https://api.github.com/users/maumar/events{/privacy}","received_events_url":"https://api.github.com/users/maumar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/cla-required","name":"cla-required","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-21T22:40:09Z","updated_at":"2015-06-04T05:22:07Z","closed_at":"2015-06-03T21:54:21Z","pull_request":{"url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/2249","html_url":"https://github.com/aspnet/EntityFramework/pull/2249","diff_url":"https://github.com/aspnet/EntityFramework/pull/2249.diff","patch_url":"https://github.com/aspnet/EntityFramework/pull/2249.patch"},"body":"Basically the issue is that we used to always attempt to pre-evaluate every method call and property that was not bound to the query (i.e. taking a column as an argument, or where column in an instance of the method/property).\r\nThis was generally desirable because users could inline some helper methods into their queries if they needed, rather than have to evaluate it manually outside the query and pass it as closure.\r\nHowever, this is incorrect for functions that are not deterministic (e.g. Guid.NewGuid(), Datetime.Now). Those functions should always be evaluated on the server.\r\nUsers should be able to extend this list of non-deterministic functions (or rather functions that should never be pre-evaluated on the client) to include their own methods (TODO)\r\n\r\nFix is to provide this functionality. On top of that translation for many other BCL functions have been added. Before function that was bound to the query would be evaluated on the client after the information from database was obtained.\r\nThis could lead to severe perf issues, if such function was part of the predicate. With this change, function will be translated to corresponding SQL construct, so that entire predicate can be evaluated on the server, resulting less data returned to the client.\r\n\r\nFunction evaluation is performed by Relinq, and there is no good way to hook into the process, so what we do is temporarily wrap appropriate MethodCallExpressions and MemberExpresions with another expression that prevents evaluation of it's contents.\r\nThis way wrapped functions will be preserved and can be passed further into the query pipeline. During sql translation we recognize the methods that we know translations for and translate to appropriate SqlFunctionExpression. Functions that we don't know how to translate will behave as all functions used to before this change - i.e. will be evaluated on the client once all the data is received from the database."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/108730710","html_url":"https://github.com/aspnet/EntityFramework/pull/2249#issuecomment-108730710","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2249","id":108730710,"user":{"login":"ErikEJ","id":4169187,"avatar_url":"https://avatars.githubusercontent.com/u/4169187?v=3","gravatar_id":"","url":"https://api.github.com/users/ErikEJ","html_url":"https://github.com/ErikEJ","followers_url":"https://api.github.com/users/ErikEJ/followers","following_url":"https://api.github.com/users/ErikEJ/following{/other_user}","gists_url":"https://api.github.com/users/ErikEJ/gists{/gist_id}","starred_url":"https://api.github.com/users/ErikEJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErikEJ/subscriptions","organizations_url":"https://api.github.com/users/ErikEJ/orgs","repos_url":"https://api.github.com/users/ErikEJ/repos","events_url":"https://api.github.com/users/ErikEJ/events{/privacy}","received_events_url":"https://api.github.com/users/ErikEJ/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T05:22:07Z","updated_at":"2015-06-04T05:22:07Z","body":"@maumar @anpete  Please do not delete branches, I am a provider writer, and need to see what has changed in an easy way"}}