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

Support for Document Databases in General #1063

Closed
craiggwilson opened this issue Nov 14, 2014 · 4 comments
Closed

Support for Document Databases in General #1063

craiggwilson opened this issue Nov 14, 2014 · 4 comments
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.

Comments

@craiggwilson
Copy link

I saw that there was a ticket for including support for DocumentDB. I hacked around today building a MongoDB provider. I haven't tackled queries yet, just the save changes stuff which all works great when the entity is flat - no nested documents or nested arrays in json speak.

So, it doesn't seem like there is any support for tracking changes in nested documents/nested arrays when they don't have a key. For a document database, these aren't relationships in the foreign key sense, but more of a parent-child in structure. I began attempting to use a Sidecar for this (like the RelationshipsSnapshot) and overriding the ChangeDetector to use it but found that I still need to be able to get a StateEntry in order to determine whether changes have been made to a nested entity. However, StateManager can only do that when a key has been defined. Ho, hum... It seems like 1 or 2 concepts are missing in the existing Metadata related to handling embedded classes/dictionarys and arrays/lists that don't exist in a separate table (or collection). This is obviously only useful for those providers able to handle this type of thing, but the same could be said about ForeignKeys only being relevant for providers able to handle relationships.

Let me know your thoughts. I'm excited about EF7 opening up to allow this type of integration and hope I'll be able to get something working.

Thanks, Craig Wilson

@anpete
Copy link
Contributor

anpete commented Nov 14, 2014

cc @smitpatel

Hi Craig,

Thanks for your interest in EF7!

I think you are right that we are lacking the correct abstractions for dealing with these kind of containment relationships in EF. One thought we had early on (and I think this is similar to some of the first things you tried) was that we could synthesize FKs for these types of graphs and that one advantage of this would be a uniform way of representing things. As you have observed, FKs in EF are first-class and not just a way of modeling relational stores - we chose to use them because they are a simple and powerful way to model associations, and also work well for other things such as disconnected graph behaviors. E.g. When round-tripping data to a browser client.

That said, we haven't had a chance to validate our thinking about this yet. @smitpatel on our team is currently investigating what Mongo support would look like and it would be great to have community involvement in uncovering the right way for EF to do this.

One additional thought that springs to mind is that these containment relationships appear to be very similar to value objects (Complex Types in EF6) - A feature we haven't added yet but know we need to. I wonder whether we can have an abstraction for containment that deals with both of these things?

Cheers,
Andrew.

@craiggwilson
Copy link
Author

Thanks for the reply. Yeah, I think there is a lot of stuff that could be done with FKs in the general sense. It's just that the current requirement includes an key field, where as a containment type's identity is derived from it's parent.

I'd love to work with you guys on this. We (MongoDB) are getting close to finishing up our next major version (2.0) of the .NET driver and have split out a core piece that is much nicer to work with when building an alternative API like EF. My email is craig.wilson at mongodb.com, so let me know if there is anything I can do to help out.

@rowanmiller rowanmiller added this to the Discussions milestone Nov 17, 2014
@divega divega modified the milestones: Backlog, Discussions May 23, 2015
@divega divega removed their assignment May 23, 2015
@divega
Copy link
Contributor

divega commented May 23, 2015

Moving straight to our backlog as we are not going to make much progress in this area for EF7 RTM, but it still of high importance after that. Also following up with Craig on email.

@smitpatel
Copy link
Member

Duplicate of #8443 ?

@smitpatel smitpatel removed this from the Backlog milestone Aug 25, 2017
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.
Projects
None yet
Development

No branches or pull requests

6 participants