-
Notifications
You must be signed in to change notification settings - Fork 352
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
DataServiceContext can't work with POCO's #1003
Comments
(As a workaround, it takes about 8 lines of code to do the HTTP fetch manually using the RequestUri exposed by the DataServiceQuery and deserialize using Json.net, so I'm OK with this now for now, but it does seem odd that it doesn't just work as is). |
As part of this I was able to also fix the problem that the existing library can't handle |
I've also managed now to implement
Which required some real trickery as currently the OData library can only generate the right query if you use an anonymous type |
While they work on the fix, would you please share some code snippets to better understand how you worked around the last two issues you listed? Thanks! |
I'm also very interested in seeing your solution to the problem @wizofaus . I'd appreciate if you could share it here. Right now I've resorted to the |
I'll have to dig out the code, it's being lying dormant for while, but sure, happy to share it. |
#Closes OData#1003
OData#1614) Added changes to DataServiceClientFormat to load edm model from network for certain cases and updated tests and regression tests for failing test cases Closes OData#1003
Given the following
It would seem there should be enough information for the OData context to be able to parse the result and construct a list of Products with the expected property values read from the JSON.
At first I just got "'The complex type 'System.Object' has no settable properties.'", which makes no sense, as DataServiceQuery is templated and knows perfectly well what type it is for, but anyway I tried setting ResolveType to a delegate that could resolve the types, but nothing I tried worked - if it always returns typeof(Product) for both "Products" and "Product" (the two type names it gets called with), it results in a single empty Product with no properties set, and if it returns a collection type for "Products" that exposes a value indexer, I just get other errors about types not being assignable.
I understand normally you'd use DataServiceContext with an edmx file but I wish to avoid this - is the OData library not designed to be able to work with POCOs the way EntityFramework can, and if so, is there any reason why this wouldn't be a worthwhile feature to add?
The text was updated successfully, but these errors were encountered: