{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/61","repository_url":"https://api.github.com/repos/Starcounter/Starcounter.Linq","labels_url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/61/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/61/events","html_url":"https://github.com/Starcounter/Starcounter.Linq/issues/61","id":359915861,"node_id":"MDU6SXNzdWUzNTk5MTU4NjE=","number":61,"title":"Query with Enum.ToString() throws System.InvalidOperationException","user":{"login":"PatrykSzwer","id":25042256,"node_id":"MDQ6VXNlcjI1MDQyMjU2","avatar_url":"https://avatars2.githubusercontent.com/u/25042256?v=4","gravatar_id":"","url":"https://api.github.com/users/PatrykSzwer","html_url":"https://github.com/PatrykSzwer","followers_url":"https://api.github.com/users/PatrykSzwer/followers","following_url":"https://api.github.com/users/PatrykSzwer/following{/other_user}","gists_url":"https://api.github.com/users/PatrykSzwer/gists{/gist_id}","starred_url":"https://api.github.com/users/PatrykSzwer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PatrykSzwer/subscriptions","organizations_url":"https://api.github.com/users/PatrykSzwer/orgs","repos_url":"https://api.github.com/users/PatrykSzwer/repos","events_url":"https://api.github.com/users/PatrykSzwer/events{/privacy}","received_events_url":"https://api.github.com/users/PatrykSzwer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-13T14:15:59Z","updated_at":"2018-09-13T14:38:45Z","closed_at":"2018-09-13T14:38:45Z","author_association":"MEMBER","body":"Calling linq like this: \r\n`DbLinq.Objects<Host>().Where(x => x.Type.ToString().Contains(\"S\").ToList();`\r\nwhere `Host`:\r\n```\r\n    [Database]\r\n    public class Host\r\n    {\r\n        public HostType Type { get; set; }\r\n    }\r\n```\r\n\r\nand `HostType` is an `Enum` will result in exception:\r\n```\r\nSystem.InvalidOperationException: variable 'x' of type 'Inventory.Database.Host' referenced from scope '', but it is not defined\r\n       at System.Linq.Expressions.Compiler.VariableBinder.Reference(ParameterExpression node, VariableStorageKind storage)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.VisitParameter(ParameterExpression node)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.Visit(Expression node)\r\n       at System.Linq.Expressions.ExpressionVisitor.VisitMember(MemberExpression node)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.Visit(Expression node)\r\n       at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.Visit(Expression node)\r\n       at System.Linq.Expressions.ExpressionVisitor.Visit(ReadOnlyCollection`1 nodes)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.VisitLambda[T](Expression`1 node)\r\n       at System.Linq.Expressions.Compiler.VariableBinder.Visit(Expression node)\r\n       at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator)\r\n       at Starcounter.Linq.Helpers.ExpressionHelper.RetrieveMethodCallValue(MethodCallExpression node)\r\n       at Starcounter.Linq.Visitors.WhereVisitor`1.VisitMethodCall(MethodCallExpression node, QueryBuilder`1 state)\r\n       at Starcounter.Linq.Visitors.WhereVisitor`1.VisitMethodCall(MethodCallExpression node, QueryBuilder`1 state)\r\n       at Starcounter.Linq.Visitors.RootVisitor`1.VisitWhere(Expression expression, QueryBuilder`1 state)\r\n       at Starcounter.Linq.QueryContext`1.Execute[TResult](Expression expression)\r\n       at Starcounter.Linq.QueryProvider.System.Linq.IQueryProvider.Execute[T](Expression expression)\r\n       at Starcounter.Linq.Queryable`1.GetEnumerator()\r\n       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n       at Starcounter.Uniform.Queryables.FilteredPaginatedDataProvider`2.get_CurrentPageRows()\r\n       at Starcounter.Uniform.ViewModels.UniDataTable.LoadRows()\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/comments/421030793","html_url":"https://github.com/Starcounter/Starcounter.Linq/issues/61#issuecomment-421030793","issue_url":"https://api.github.com/repos/Starcounter/Starcounter.Linq/issues/61","id":421030793,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTAzMDc5Mw==","user":{"login":"PatrykSzwer","id":25042256,"node_id":"MDQ6VXNlcjI1MDQyMjU2","avatar_url":"https://avatars2.githubusercontent.com/u/25042256?v=4","gravatar_id":"","url":"https://api.github.com/users/PatrykSzwer","html_url":"https://github.com/PatrykSzwer","followers_url":"https://api.github.com/users/PatrykSzwer/followers","following_url":"https://api.github.com/users/PatrykSzwer/following{/other_user}","gists_url":"https://api.github.com/users/PatrykSzwer/gists{/gist_id}","starred_url":"https://api.github.com/users/PatrykSzwer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PatrykSzwer/subscriptions","organizations_url":"https://api.github.com/users/PatrykSzwer/orgs","repos_url":"https://api.github.com/users/PatrykSzwer/repos","events_url":"https://api.github.com/users/PatrykSzwer/events{/privacy}","received_events_url":"https://api.github.com/users/PatrykSzwer/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T14:38:45Z","updated_at":"2018-09-13T14:38:45Z","author_association":"MEMBER","body":"Reason is that our SQL doesn't support `CONVERT` method and SC.Linq can't support ToString bc of that. Closing as not fixable."}}
{"actor":{"display_login":"PatrykSzwer"}}