{"action":"created","issue":{"url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/1","labels_url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/1/comments","events_url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/1/events","html_url":"https://github.com/Pathoschild/webapi.nhibernate-odata/issues/1","id":24744015,"number":1,"title":"Can not translate `substringof`","user":{"login":"Ridermansb","id":725337,"avatar_url":"https://avatars.githubusercontent.com/u/725337?v=3","gravatar_id":"","url":"https://api.github.com/users/Ridermansb","html_url":"https://github.com/Ridermansb","followers_url":"https://api.github.com/users/Ridermansb/followers","following_url":"https://api.github.com/users/Ridermansb/following{/other_user}","gists_url":"https://api.github.com/users/Ridermansb/gists{/gist_id}","starred_url":"https://api.github.com/users/Ridermansb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ridermansb/subscriptions","organizations_url":"https://api.github.com/users/Ridermansb/orgs","repos_url":"https://api.github.com/users/Ridermansb/repos","events_url":"https://api.github.com/users/Ridermansb/events{/privacy}","received_events_url":"https://api.github.com/users/Ridermansb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2013-12-24T11:40:19Z","updated_at":"2015-05-18T21:30:02Z","closed_at":"2015-05-18T21:30:02Z","body":"I have a base class `baseApi` which define the method Get\r\n\r\n```c#\r\n[HttpGet, Queryable(AllowedQueryOptions = AllowedQueryOptions.All, PageSize = 25), FixOdataQuery]\r\npublic IQueryable<TEntidade> Get()\r\n{\r\n\treturn Repositorio.All();\r\n}\r\n```\r\n\r\nWhen you run the query: `{{odata}}/GruposUsuarios?$orderby=Nome&$inlinecount=allpages&$filter=substringof('cla', Nome) eq true`\r\n\r\n> `{{odata}}` = base uri for odata like (localhost:9999/OData)\r\n\r\n## Error:\r\n\r\n```json\r\n    \"odata.error\": {\r\n        \"code\": \"\",\r\n        \"message\": {\r\n            \"lang\": \"en-US\",\r\n            \"value\": \"An error has occurred.\"\r\n        },\r\n        \"innererror\": {\r\n            \"message\": \"Exception has been thrown by the target of an invocation.\",\r\n            \"type\": \"System.Reflection.TargetInvocationException\",\r\n            \"stacktrace\": \"   at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()\",\r\n            \"internalexception\": {\r\n                \"message\": \"Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [.LongCount[AeCAudit.Dominio.GrupoUsuario](.Where[AeCAudit.Dominio.GrupoUsuario](NHibernate.Linq.NhQueryable`1[AeCAudit.Dominio.GrupoUsuario], Quote(($it, ) => (Equal(Equal(Or(Equal(Convert($it.Nome), NULL), p1) ? NULLp3 : Convert(Convert($it.Nome).Contains(p2, )), p4), p5))), ), )]\",\r\n                \"type\": \"NHibernate.Hql.Ast.ANTLR.QuerySyntaxException\",\r\n                \"stacktrace\": \"   at NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException()\\r\\n   at NHibernate.Hql.Ast.ANTLR.HqlSqlTranslator.Translate()\\r\\n   at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2 replacements, Boolean shallow, String collectionRole)\\r\\n   at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IASTNode ast, String queryIdentifier, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory)\\r\\n   at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryIdentifier, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory)\\r\\n   at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters)\\r\\n   at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow)\\r\\n   at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression)\\r\\n   at NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery)\\r\\n   at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression)\\r\\n   at QueryInterceptor.QueryTranslatorProvider`1.Execute(Expression expression)\\r\\n   at QueryInterceptor.QueryTranslatorProvider`1.Execute[TResult](Expression expression)\\r\\n   at System.Linq.Queryable.LongCount[TSource](IQueryable`1 source)\"\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\n\r\n## Code:\r\n\r\n### Domain class\r\n\r\n```c#\r\npublic class GrupoUsuario : IEntidade\r\n{\r\n\tpublic virtual int Id { get; set; }\r\n\r\n\t[StringLength(90)]\r\n\t[Required]\r\n\tpublic virtual string Nome { get; set; }\r\n}\r\n```\r\n\r\n### Api base\r\n\r\n```c#\r\n[Authorize]\r\npublic abstract class BaseEntidadeController<TEntidade> : ODataController\r\n\twhere TEntidade : class, IEntidade\r\n{\r\n\tprotected IRepositorio<TEntidade> Repositorio { get; private set; }\r\n\r\n\tpublic BaseEntidadeController(IRepositorio<TEntidade> repositorio)\r\n\t{\r\n\t\tRepositorio = repositorio;\r\n\t}\r\n\r\n\t[HttpGet, Queryable(AllowedQueryOptions = AllowedQueryOptions.All, PageSize = 25), FixOdataQuery]\r\n\tpublic IQueryable<TEntidade> Get()\r\n\t{\r\n\t\treturn Repositorio.All();\r\n\t}\r\n\r\n\t\r\n\t[Queryable(MaxExpansionDepth = 3)]\r\n\tpublic virtual SingleResult<TEntidade> Get([FromODataUri]int key)\r\n\t{\r\n\t\treturn SingleResult.Create<TEntidade>(Repositorio.Query(c => c.Id == key));\r\n\t}\r\n\r\n}\r\n```\r\n\r\n## Packages\r\n\r\n1. Microsoft.AspNet.WebApi        5.0.0\r\n2. Microsoft.AspNet.WebApi.Client 5.0.0\r\n3. Microsoft.AspNet.WebApi.Core   5.0.0\r\n4. Microsoft.AspNet.WebApi.OData  5.0.0\r\n5. Microsoft.AspNet.WebApi.Web... 5.0.0\r\n6. Pathoschild.WebApi.NHiberna... 0.1.0-alpha "},"comment":{"url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/comments/103217940","html_url":"https://github.com/Pathoschild/webapi.nhibernate-odata/issues/1#issuecomment-103217940","issue_url":"https://api.github.com/repos/Pathoschild/webapi.nhibernate-odata/issues/1","id":103217940,"user":{"login":"Pathoschild","id":230581,"avatar_url":"https://avatars.githubusercontent.com/u/230581?v=3","gravatar_id":"","url":"https://api.github.com/users/Pathoschild","html_url":"https://github.com/Pathoschild","followers_url":"https://api.github.com/users/Pathoschild/followers","following_url":"https://api.github.com/users/Pathoschild/following{/other_user}","gists_url":"https://api.github.com/users/Pathoschild/gists{/gist_id}","starred_url":"https://api.github.com/users/Pathoschild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pathoschild/subscriptions","organizations_url":"https://api.github.com/users/Pathoschild/orgs","repos_url":"https://api.github.com/users/Pathoschild/repos","events_url":"https://api.github.com/users/Pathoschild/events{/privacy}","received_events_url":"https://api.github.com/users/Pathoschild/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T21:30:02Z","updated_at":"2015-05-18T21:30:02Z","body":"Thanks for the contribution @cdroulers! The pull request was merged in, so the issue should be fixed now."}}