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

Inheritance implementation for Fluent API #32

Merged
merged 15 commits into from
Sep 27, 2024

Conversation

oformaniuk
Copy link
Contributor

Resolves #29

Implementation recursively checks all base types for existence of Fluent* attributes.

@m31coding
Copy link
Owner

@oformaniuk Thank you very much for this PR! I am impressed that you were able to implement the feature in just 15 lines of code. I plan to write some additional tests and aim to merge it within the next two weeks.

Best regards,
Kevin

@m31coding m31coding self-assigned this Sep 22, 2024
@@ -90,9 +90,9 @@ private ClassInfoResult CreateFluentApiClassInfoInternal(
FluentApiAttributeInfo fluentApiAttributeInfo =
FluentApiAttributeInfo.Create(attributeDataExtended.AttributeData, className);

List<FluentApiInfo> infos = new List<FluentApiInfo>();
HashSet<FluentApiInfo> infos = new HashSet<FluentApiInfo>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there can't be duplicates and we can stick with the list.

@m31coding
Copy link
Owner

The implementation turned out to be more complex in cases where the base class contains private methods and private setters. In such scenarios, reflection must target the base class instead of the derived class. For example:

namePropertyInfo = typeof(Person).GetProperty("Name", ...

instead of

namePropertyInfo = typeof(Student).GetProperty("Name", ...

Best regards,
Kevin

@m31coding m31coding merged commit 5811737 into m31coding:main Sep 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Allow inheritance
2 participants