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

Unable to select single Schema Type #404

Open
blycolin-dev opened this issue Jul 23, 2024 · 9 comments
Open

Unable to select single Schema Type #404

blycolin-dev opened this issue Jul 23, 2024 · 9 comments
Assignees

Comments

@blycolin-dev
Copy link

Describe the bug

When selecting a single schema type, a lot more are added.
In my example Dynamics 365 Operations odata metadata selected in address.

Default all 5970 are selected
First deselect all
Then select for example AbsenceCode, then an additional 2551 are also selected.

Ofcourse creating too many code. I only wanted one.

A few are single selectable but most not.

Version of the Project affected

ODataConnectedService v1.1.0
VisualStudio Version v17.10.4

Expected behavior

Single entity selection
schematype

@gathogojr
Copy link
Contributor

Thank you @blycolin-dev for reaching out to us. You would observe the behaviour if the AbsenceCode schema type is has a dependency on the schema types that are being auto-selected. Please confirm if the schema types are dependent one another.

@wandeg
Copy link
Member

wandeg commented Jul 23, 2024

@blycolin-dev
Copy link
Author

Hi, thanks for your comments.

I find it hard to believe there are so many depended entites.

In Dynamics i can get the data from Customers by entering just this URL , for ex. : https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/CustomerV3

I can see the same CustomerV3 entity in the ODATA schema type selection.
So I would like to be able to just only select this CustomerV3.

I just tested to select the CustomerV3 with the odataconnectserice, and I see that that, maybe coincidence, but again 2552 selected. Some more customer related but also for ex. ProductSize , ProductCategory and SalesOrder and so on.

Can imagine that there are relations between all those enities , but where I connect to the ODATA with for ex. PowerBI I can perfectly connect to the CustomerV3 without having to select any other.

It would be great to be able to do the same with this connector.

Thanks.

@habbes
Copy link
Contributor

habbes commented Jul 24, 2024

@blycolin-dev it would be hard to tell without having access to the actual schema whether what you're experience is existing behaviour or a bug. Without having any concrete example we can't rule out the possibility that the CustomerV3 entity has direct or indirect dependencies to seemingly unrelated types like ProductSize, etc. For example, if CustomerV3 entity has a "Orders" navigation property of type Order, which in turn happens to have a property of type SalesOrder and a navigation property Products of some type ProductOrder with properties of types ProductSize and ProductCategory, then CustomerV3 transitively has dependencies to ProductCategory and ProductSize. Could you verify whether a scenario like this does not occur in your schema?

If such dependencies exist, then OData Connected Service will automatically include those types. If it does not, then the generated code will not compile because CustomerV3 will be generated with a reference to a type which does not exist in the code. Currently when selecting a type, all its properties will be generated, we don't provide a way to selectively exclude properties of a type.

Does the PowerBI connector that you referred to also generate client code? I would be interesting in seeing the code it generates for such a scenario and how it prevents issues related to missing dependencies.

If on the other hand types that depend on CustomerV3 (e.g. types that have a reference to CustomerV3) but that CustomerV3 does not depend on are also included, then this would be a bug.

@lucacivale
Copy link

This is indeed working as designed. We also work with a Dynamics 365 endpoint and the entities have indirect dependencies through relations. Due to the size of the endpoint it is nearly impossible to use the extension and Dynamics 365 implemented some workarounds. You either have to manipulate/trim the metadata document and pass it to the extension or fork the repro and disable the auto selection of related types. I already opened issue #303. The issue isn't up to date and some other changes must be done as well. I can assist with the implementation if this is considered for the product.

@habbes
Copy link
Contributor

habbes commented Jul 25, 2024

@lucacivale thanks for contributing to this thread. What kind of product changes would you suggest to handle issues related to such large dependency graphs? I assume it would require excluding properties that lead that refer to unselected types?

@blycolin-dev
Copy link
Author

@lucacivale @habbes Thanks for your help and suggestions.
Yes, working as designed ,leading to select so many entities makes it too complex (for me atleast ;-) ) and slow also.

Maybe it is possible to see the depend entities as "suggestions" but not being forced to select them.

I know that if I want Customer data with my SalesOrderheaders I have to select them both, if I want SalesorderLines that one too and so on.
But if I only what a very simple list of Customer numbers and names, i do not have to know anything about Salesorder/Project/HRM entities or types.

@lucacivale
Copy link

@blycolin-dev since we want the same change I think we should close this issue and continue the discussion on #303 since there is already some documentation.

@blycolin-dev
Copy link
Author

Ok let do that! Thanks.

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

5 participants