-
Notifications
You must be signed in to change notification settings - Fork 191
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
Problems in selecting columns in related entites with expand #92
Comments
Thank you for the issue report. I will investigate it and get back to you. |
I have uploaded the version 4.3.1 with a few changes to Expand/Select logic. However I was not able to reproduce exactly your scenario. Can you try 4.3.1 and if you are still getting all fields selected I would like to check the HTTP GET calls generated by the library (and the sample code). |
Hi, The api call:
The http GET call: GET /odata/ClientProductSkus?$filter=ClientId%20eq%2035&$expand=Product($expand=ProductCategory($expand=Category))&$select=PartNo,ClientId&$count=true HTTP/1.1 As you can see it does not add the select for the Category entity/resource. I'm not quite sure how the the uri should look but I tried this: Unfortunately it didn't work. I'm getting the following OData error (in the browser): |
That's strange. I checked my integration tests and I have a test for similar functionality here:
Is it possible for you to generate and example that I might try myself? Or give me a temporary access to your OData service? |
Unfortunately I can not give you access to the customer's OData service. Fyi the OData service is done with web api 2, entity framework with an existing data model. I also tried to the typed syntax to see if that made any difference but with same result as before Select(x => new {x.ClientId, x.PartNo, CategoryCode = x.Product.ProductCategory.Select(y=>y.Category.Code)}) I'll try to put together an example later this week with an public OData service. I just hope I cant get the same issue with that? |
Alternative is if you can extract a sample project (and some sample data) that I can build myself and check what's going on. Ideally a project with a test that fails. |
Sorry, Closed by mistake. I was thinking where it might go wrong. Can it be that there is something wrong in the Odata Service which causes the client to behave like this? In that case, would it help you if I send the metadata file to you? Otherwise the only option, as you have mentioned above, is to try to reproduce the problem in a sample project. |
Yes, I can look at the metadata document, perhaps it will uncover something. |
Do you have any email adress I can send it to? |
I think the issue with expansion is fixed. It will be a part of the version 4.5 that will be out sometime next week, but you can check out its pre-release from MyGet feed: |
That's great new vagif! On Tuesday, April 14, 2015, Vagif Abilov notifications@github.com wrote:
Sent from Gmail Mobile |
Hi Vagif, I have tested version 4.5.3 of the client with our code and we are still experiencing the same problem. We have the following code:
This gives us the url:
But it should rather be something like this:
I hope this is sufficient info for you. |
No it's not sufficient. I can't find in the metadata file that you earlier sent me a function definition for "FunctionNameGetCreateUpdateSkuDelta". And knowing metadata structure is crucial to find an error. Please send recent metadata document to me. |
Hi Vagif |
Please checkout version 4.5.4. I made a fix. |
Hi Vagif, |
For people who use typed approach, extend "select" method using .Net reflection. As an example there is extension method below:
Example of use: Later I will create pull request. |
Hi!
I have been trying to get simple.odata.client ODATA v4 to work with a complex datastructure where I just want to select certain columns in each table on different levels. I have been using the untyped version. The problem I'm having that it is only selecting on the top level. If I have the following structure:
public class A
{
int Id;
string Name;
string description;
List BList;
}
public class B
{
int Id;
string Name;
string description;
List CList;
}
public class C
{
int Id;
string Name;
string description;
}
What I'm expecting to get is an untyped object which looks like this:
A: {Name, Description, BList:{Name, CList:{Id, Name}}}
Unfortunately I'm getting the all the properties for B and C
The text was updated successfully, but these errors were encountered: