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

IQueryable<dynamic> is it supported? #42

Open
BakriBadawi opened this issue Oct 20, 2014 · 8 comments
Open

IQueryable<dynamic> is it supported? #42

BakriBadawi opened this issue Oct 20, 2014 · 8 comments
Labels

Comments

@BakriBadawi
Copy link

I have an IQueryable and i which to filter it
but the problem when I use LinqToQuerystring I got this exeption
No method 'get_Item' exists on type 'System.Object'.

here is my code
[HttpGet]
public PageResult GetforGrid(ODataQueryOptions options, string data1)
{
try
{
DynamicTableRep dynamicTableRep = new DynamicTableRep(data1);
dynamic tbltype = dynamicTableRep.GetType();

            var dynamicQueryable = dynamicTableRep.GetAllAsQueryable();
            IQueryable<dynamic> qResult = dynamicQueryable.LinqToQuerystring(this.Request.RequestUri.Query, true);

            var results = options.ApplyTo(qResult);
            return new PageResult<dynamic>(results as IEnumerable<dynamic>,
                Request.GetNextPageLink(), Request.GetInlineCount());
        }
        catch (Exception ex)
        {
            Logs.Log(ex);
            return null;
        }
    }

1
2

@beyond-code-github
Copy link
Owner

Hi there,

I'll need to get back to you on whether or not use of dynamic is possible. At this time it is not officially. supported

I know for sure that you can use LinqToQuerystring against an IDictionary<string, object> so if the data structure underlying the dynamic object can be put into that form then you may be able to do things that way.

Pete

@shivu333
Copy link

shivu333 commented Dec 2, 2014

@BakriBadawi may i know the solution for this error?

@BakriBadawi
Copy link
Author

Until now i couldn't find a solution for this error.

@shivu333
Copy link

shivu333 commented Dec 3, 2014

@BakriBadawi for me it is working fine now, I am not sure, how it
It looks like problem with URL.
I will try to reproduce it & let you know if any luck.
can you share your url pattern to examine?

@BakriBadawi
Copy link
Author

@shivu333 this is smple of the URL
?$filter=substringof(%27a%27,Prefix)&$inlinecount=allpages&$top=10&$skip=0

@Jogai
Copy link

Jogai commented Jul 13, 2016

Well, now I get this feeling:
All long help threads should have a sticky globally-editable post at the top saying 'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'

@beyond-code-github
Copy link
Owner

Oh nooo! I'll admit I haven't had the time to invest in this recently, my comment from 2014 should still be relevant though.

@Jogai
Copy link

Jogai commented Jul 13, 2016

Thanks for the quick answer ;)
It was more directed to @shivu333 because its working for him, but we dont know how...

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

No branches or pull requests

4 participants