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

Implementation of a Max Depth for member scanning #638

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ilya-at-prettyneat
Copy link

Adds the DepthLimit attribute and the ability to set depth limits in the Fluent Config.
If the DepthLimit is set for a specific column, that column will not explore all the possible branches but rather stop after computing all the paths with a maximum distance of N from its source.

As an example, if you set it like:

c.Column(m => m.MyProp).Reference( m => m.Id, ReferenceType.OneToOne).LimitMappingDepth(2)

That means that it will explore all the members in MyProp, if it finds child members in MyChildProp it will explore those too, but then it will not go further away from MyProp (depth 2 reached).

The loop protection is still valid and in place, but this adds to it and is invaluable if you have data structures with several foreign keys that can branch, as the flattening of that tree can lead to hundreds of thousands of possible paths.

Use as a typical NPoco column attribute or at the end of a Column or Many declaration in fluent config.

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.

1 participant