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

One-to-many relationship metadata is not generated correctly. #135

Closed
Zerajima opened this issue Feb 19, 2024 · 5 comments
Closed

One-to-many relationship metadata is not generated correctly. #135

Zerajima opened this issue Feb 19, 2024 · 5 comments

Comments

@Zerajima
Copy link

Zerajima commented Feb 19, 2024

Looking at MetadataGenerator.PopulateRelationshipProperty method I can see that One-to-many and Many-to-one relationships are not generated properly. In both cases ReferencedEntity/ReferencedAttribute and ReferencingEntity/ReferencingAttribute pairs are switched.

When dataverse generates One-to-many relationship, ReferencedEntity represents "One" part of relationship and ReferencingEntity represents "many" side of relationship. So if we have a collection property, that represents One-to-many relationship, the type in which this property is located should be ReferencedEntity and the generic argument of collection should be ReferencingEntity.

@jordimontana82
Copy link
Contributor

jordimontana82 commented Feb 19, 2024

Thanks @Zerajima for your feedback.

@BetimBeja can you confirm the above? We might need to swap parameters in these calls if the above is correct:

https://github.com/DynamicsValue/fake-xrm-easy-core/blob/2x-dev/src/FakeXrmEasy.Core/Metadata/MetadataGenerator.cs#L176-L186

@BetimBeja
Copy link

I will need to test this.
I thought I had unit tests to validate this at the time.

@BetimBeja
Copy link

hey, it is almost the 5-year anniversary of this change 🤣
jordimontana82/fake-xrm-easy#396

No tests for relationship metadata apparently

@jordimontana82
Copy link
Contributor

@BetimBeja Yep! Time flies... almost the 10th anniversary of FXE! 😄 I added some when it was needed for a PR to pass the quality gate #77

@jordimontana82
Copy link
Contributor

This made it to 2.6 and 3.6 versions

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

3 participants