Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object Reference Error when using substringof #47

Open
DamageInc54 opened this issue Dec 23, 2014 · 4 comments
Open

Object Reference Error when using substringof #47

DamageInc54 opened this issue Dec 23, 2014 · 4 comments

Comments

@DamageInc54
Copy link

I'm receiving the following exception when performing a query using the substringof function. The same error happens when trying endswith.

at LinqToQuerystring.TreeNodes.Base.TreeNode.get_ChildNodes()
at LinqToQuerystring.TreeNodes.FilterNode.BuildLinqExpression(IQueryable query, Expression expression, Expression item)
at LinqToQuerystring.Extensions.BuildQuery(TreeNode node, IQueryable& queryResult, IQueryable& constrainedQuery)
at LinqToQuerystring.Extensions.LinqToQuerystring(IQueryable query, Type inputType, String queryString, Boolean forceDynamicProperties, Int32 maxPageSize)
at LinqToQuerystring.Extensions.LinqToQuerystring[T](IQueryable`1 query, String queryString, Boolean forceDynamicProperties, Int32 maxPageSize)

The query string is:

...leads?$filter=substringof('eff', FirstName) eq true

When I use this same resource with the following query string, everything works perfectly.

...leads?$filter=FirstName eq 'jeff'

This is for a .NET 4.5 application using Entity Framework 6.1.0. The call to LinqToQuerystring is from an existing IQueryable object. Basically, I'm returning an IQueryable object for an initial query on a DbSet that has to be done regardless, then if there is a valid OData query string passed in, I then call LinqToQuerystring on that existing IQueryable.

// Returns an IQueryable to filter leads for a given member first.
var query = leadQuery.GetAvailableLeadsForMember(LoginInfoContainer.MemberInfo.WcMemberId);

// If we don't have any OData parameters, then just return the normal query.
query = string.IsNullOrEmpty(oDataQuery)
? query
: query.LinqToQuerystring(oDataQuery);

Any ideas?

@maganuk
Copy link

maganuk commented Dec 8, 2015

was there any resolution to this issue? i'm facing the same.

@mylemans
Copy link

mylemans commented Sep 7, 2016

I'm having the same issue :/

@burkicedi
Copy link

same here.. is there already a solution?

@ohager
Copy link

ohager commented Apr 11, 2017

Having the same issue right now, but the solution is not to use whitespace after the comma!

Does not work: "substringof('Foo', Name) eq true"
Works fine: "substringof('Foo',Name) eq true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants