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

CircularReference management #5

Open
MonDeveloper opened this issue Sep 25, 2015 · 3 comments
Open

CircularReference management #5

MonDeveloper opened this issue Sep 25, 2015 · 3 comments
Assignees

Comments

@MonDeveloper
Copy link

This library is exactly what many people working with EF are looking for, unfortunately there's a missing feature that makes it unusable, the capability to clone graph of objects with circular references.

EF Graphs are by default CircularReference Graphs because into the Parent table there is a Collection of Cildren and into the Child table there is the Reference of the Parent.

I tried to fork and to work on your code to add this feature but I'm not enough skilled to do with an acceptable level of quality so I'm asking you if you could work on it to add this functionality.
I'm also available to pay you something for your effort.

Thanks again!
mM

@mijay mijay self-assigned this Sep 29, 2015
@mijay
Copy link
Owner

mijay commented Sep 29, 2015

I think you can achieve that by tweaking ReplicationContext. Iso of "get value" api it should get "set value" api - something like void Replicate(object source, Action<object> resultSetter). Then in case of detected circular references, it can postpone setting a reference until the end of the cloning procedure.

Though this change might have quite a significant performance impact. I'll give it a try.

@mijay
Copy link
Owner

mijay commented Oct 16, 2015

I'm done with naive implementation - you can find it in commit 60bde85. Though it does not perform well enough, so I have to spend more time on tweaking it, before it can go to master.

@MonDeveloper
Copy link
Author

I gave a look at the commit and it seems interesting.
In the meanwhile, since this time I'm in position to manage the t4 of the EF model, I opted for a T4 solution where I use a Queue to deal with references objects in order to avoid looping during the clone.

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

No branches or pull requests

2 participants