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

Use Alternate Keys (Business Keys) to connect disconnected graph as the primary keys are not part of DTO/Disconnected Entity. #106

Open
braydon-1243 opened this issue Oct 5, 2023 · 0 comments

Comments

@braydon-1243
Copy link

First of all, thank you very much for your hard work and dedication to this library.

Introduction

We were previously using EF6 with GraphDiff and now looking to upgrade to EF Core. This is the best solution I've have found yet to solve disconnected entities! One caveat to implementing Detached-Mapper is that we had to make extensive changes to GraphDiff to suit our situation (expanded on later). I'm wondering if there were some changes that you could make that would help this work for us with any/many modifications which would help us stay up to date with your new releases and new EF Core releases.

The problem

We are constantly working with disconnected entities (DTOs) that will never (out of our control) contain their corresponding database generated IDs. Most of presented solutions online for working with disconnected entities (including this solution) make the assumption that the DTOs will contain the primary key ID if the entity already exists in the database.

Ideal solution

I would like some way of using alternate keys when working with disconnected graphs.

Attempt to solve

I have created some changes to your solution that make this feature somewhat functional (this was just for testing, I realize there is no chance that you would pull these changes in as they are currently configured) . Also, I have not spent enough time to fully work out all the edge cases so I'm not sure if what I have implemented works in all cases. Either way it would be nice if there was some if there was some more functionality implemented to work for this situation.

See my commit fdb8998 where these changes were made. I think the idea solution would give the flexibility to use Primary Keys or Alternative Keys, depending on how the configuration is setup.

Let me know what you think! Thank you!

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

1 participant