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

WIP: Entity Relationship Refactor #60

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@Turnerj
Copy link
Member

commented May 14, 2019

Entity Relationships currently are not implemented very well:

  • You can't track changes to single entity relationships (requires the full write)
  • You can't delete relationships by nullifying the navigation property
  • If multiple entities have the same relationship to another entity, it isn't smart enough to share a reference
  • Similar to point 3, if you have the same related entity across multiple collections, each will compete when saving the entity

All of these points are pretty crap.

To address the issue, a number of changes are required with the most major being that there needs to be a central "collection" shared between data contexts and DB sets. This central collection would allow entities from multiple collections to reference the same instance of a related entity. It would also allow easier tracking of changes and potentially an easier method of support transactions.

This is a big change though - currently MongoDbSet can be run independently of a context. While it still might be possible, this will tie it much closer to the context than before.

Part of this change will see there being a new Set<TEntity>() method available on the context, similar to Entity Framework, which basically references an internal DB set. This method would be used to initialise the properties on the inherited context.

Much of the code that exists now will remain and will still be tied to generics (TEntity) however some pieces like EntityEntry likely need to change.

@codecov

This comment has been minimized.

Copy link

commented May 14, 2019

Codecov Report

Merging #60 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #60   +/-   ##
=======================================
  Coverage   92.61%   92.61%           
=======================================
  Files          68       68           
  Lines        2303     2303           
=======================================
  Hits         2133     2133           
  Misses        170      170
Impacted Files Coverage Δ
...oFramework/Infrastructure/EntityEntryExtensions.cs 100% <ø> (ø) ⬆️
...goFramework/Infrastructure/EntityCommandBuilder.cs 100% <ø> (ø) ⬆️
...mework/Infrastructure/Commands/AddEntityCommand.cs 100% <100%> (ø) ⬆️
.../MongoFramework/Infrastructure/EntityCollection.cs 95.78% <100%> (ø) ⬆️
...ork/Infrastructure/Commands/UpdateEntityCommand.cs 100% <100%> (ø) ⬆️
...ework/Infrastructure/EntityNavigationCollection.cs 93.42% <100%> (ø) ⬆️
...goFramework/Infrastructure/EntityWriterPipeline.cs 90.47% <100%> (ø) ⬆️
src/MongoFramework/Infrastructure/EntityEntry.cs 100% <100%> (ø) ⬆️
...ork/Infrastructure/Commands/RemoveEntityCommand.cs 100% <100%> (ø) ⬆️
...rk/Infrastructure/EntityBucketStagingCollection.cs 92% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a31ce7...39ab467. Read the comment docs.

1 similar comment
@codecov

This comment has been minimized.

Copy link

commented May 14, 2019

Codecov Report

Merging #60 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #60   +/-   ##
=======================================
  Coverage   92.61%   92.61%           
=======================================
  Files          68       68           
  Lines        2303     2303           
=======================================
  Hits         2133     2133           
  Misses        170      170
Impacted Files Coverage Δ
...oFramework/Infrastructure/EntityEntryExtensions.cs 100% <ø> (ø) ⬆️
...goFramework/Infrastructure/EntityCommandBuilder.cs 100% <ø> (ø) ⬆️
...mework/Infrastructure/Commands/AddEntityCommand.cs 100% <100%> (ø) ⬆️
.../MongoFramework/Infrastructure/EntityCollection.cs 95.78% <100%> (ø) ⬆️
...ork/Infrastructure/Commands/UpdateEntityCommand.cs 100% <100%> (ø) ⬆️
...ework/Infrastructure/EntityNavigationCollection.cs 93.42% <100%> (ø) ⬆️
...goFramework/Infrastructure/EntityWriterPipeline.cs 90.47% <100%> (ø) ⬆️
src/MongoFramework/Infrastructure/EntityEntry.cs 100% <100%> (ø) ⬆️
...ork/Infrastructure/Commands/RemoveEntityCommand.cs 100% <100%> (ø) ⬆️
...rk/Infrastructure/EntityBucketStagingCollection.cs 92% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a31ce7...39ab467. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.