Coder Social home page Coder Social logo

finaps / eventsourcing Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 2.0 818 KB

Event Sourcing in .NET 6

License: Apache License 2.0

C# 70.41% JavaScript 29.59%
cqrs dotnet eventsourcing cosmosdb entity-framework-core postgresql sql-server dotnet-core ef-core event-sourcing ddd entity-framework eventstore

eventsourcing's Issues

ConsecutiveIndex constraint fail when using multiple Apply methods on save entity

Current behavior:
When using multiple Apply methods EFCore provider doesn't preserve their order on insert.

My code that fails

        Apply(new CompetitionCreatedEvent());
        Apply(new CompetitionNameSetEvent(name));
        Apply(new CompetitionLogoSetEvent(logo));

EF then try to sort entities alphabetically on insert thus getting into constraint violation

You can check issue here dotnet/efcore#11686
This issue lead me to PR dotnet/efcore#25874 where inserted entities are ordered using StringComparer.Ordinal

After digging source code found the piece of code that cause this

	case AddEventsAction(var events):
    	_store.Context.AddRange(events);
        break;

Proposed solution:
As a solution I can only think of Bulk insert wrapped in transaction. Maybe you'll find a better way

NotNull Constraints fail when not using Shared Columns in Finaps.EventSourcing.EF

The NotNull Constraints generated for each Event fail when Event.PropertyName is not mapped to nameof(Event.PropertyName).

This happens when for example two Events with the same property name are mapped to the same table, but don't inherit this property from a shared base class. (see here for more info)

The NotNull implementation should be aware of EF.Core's naming conventions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.