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 Framework #500

Closed
wants to merge 11 commits into from

Conversation

frankebersoll
Copy link
Contributor

@frankebersoll frankebersoll commented Jun 26, 2018

Todo

  • Read Model
  • Snapshots
  • Refactor configuration
  • DbContext lifetime management
  • Logging

Nice to have

  • Postgres integration test
  • byte[] Version/Timestamp
  • Value Types for Id properties
  • Entity Framework 6

See also #260

@codecov
Copy link

codecov bot commented Jun 26, 2018

Codecov Report

Merging #500 into develop will decrease coverage by 0.89%.
The diff coverage is 88.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop     #500     +/-   ##
==========================================
- Coverage    75.94%   75.05%   -0.9%     
==========================================
  Files          269      271      +2     
  Lines         6794     7008    +214     
  Branches       570      596     +26     
==========================================
+ Hits          5160     5260    +100     
- Misses        1385     1489    +104     
- Partials       249      259     +10
Impacted Files Coverage Δ
...entFlow.EntityFramework/EventStores/EventEntity.cs 100% <100%> (ø)
...tFlow/Exceptions/OptimisticConcurrencyException.cs 100% <100%> (ø) ⬆️
.../EventFlow.MsSql/ReadStores/MssqlReadModelStore.cs 98.19% <100%> (-0.04%) ⬇️
...tityFramework/Extensions/ModelBuilderExtensions.cs 100% <100%> (ø)
...tFlow.SQLite/EventStores/SQLiteEventPersistence.cs 89.36% <66.66%> (ø) ⬆️
...ow.EntityFramework/EntityFrameworkConfiguration.cs 78.26% <78.26%> (ø)
...ork/EventStores/EntityFrameworkEventPersistence.cs 83.78% <83.78%> (ø)
...mework/ReadStores/EntityFrameworkReadModelStore.cs 89.75% <89.75%> (ø)
...sions/EventFlowOptionsEntityFrameworkExtensions.cs 95.83% <95.83%> (ø)
...EventFlow.RabbitMQ/RabbitMqDomainEventPublisher.cs 0% <0%> (-100%) ⬇️
... and 36 more

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 3795a67...3d4ab19. Read the comment docs.

Copy link
Contributor Author

@frankebersoll frankebersoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need some help here


namespace EventFlow.EntityFramework.Extensions
{
public static class Bulk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not proud of this one. Please help. See comment for further information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to delete entities without querying them first: https://www.google.de/search?q=ef+core+"delete+where"

There seems to be a package that supports batch delete, but 1.) that's lots of code, 2.) it needs a reference to Microsoft.EntityFrameworkCore.Relational (that we don't need otherwise) - and 3.) obviously it needs to hardcode SQL commands for the major providers. Which means it only works for those, probably: https://github.com/zzzprojects/EntityFramework-Plus/blob/master/src/shared/Z.EF.Plus.BatchDelete.Shared/BatchDelete.cs

This affects both Read Stores and Snapshot Stores.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, no help here, haven't worked with EF in almost five years. Pretty sure I'm outdated (we use Dapper for almost everything)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This topic seems to continue discussing in long time. (dotnet/efcore#6567)
Something like a Delete extension method might not be implemented for the time being in EF side.

To resolve 3.) concern, take on 1.) and 2.)
This PoC is idubnori#4

@rasmus
Copy link
Member

rasmus commented Sep 19, 2018

Implemented in #514

@rasmus rasmus closed this Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants