Reactive extension wrappers for *hot* observables of Entity Framework
C#
Latest commit 09995cb Jan 24, 2017 @NickStrupat committed on GitHub Update README.md

README.md

EntityFramework.Rx

Reactive extension wrappers for hot observables of Entity Framework entities.

This repo contains the code for both the EntityFramework and EntityFrameworkCore projects.

  • FromInserting
  • FromInsertFailed
  • FromInserted
  • FromUpdating
  • FromUpdated
  • FromUpdateFailed
  • FromDeleting
  • FromDeleted
  • FromDeleteFailed

Installation

Simply install the NuGet package for EF6 or EF Core

EF version .NET support NuGet package
6.1.3 == 4.0 || >= 4.5 NuGet Status
Core 1.1 >= 4.5.1 || >= Standard 1.3 NuGet Status

Usage

DbObservable contains methods for each event type supported, which return an IObservable.

var birthdayMessage = DbObservable<Context>.FromInserted<Person>()
                                           .Where(x => x.Entity.DateOfBirth.Month == DateTime.Today.Month
                                                    && x.Entity.DateOfBirth.Day == DateTime.Today.Day)
                                           .Subscribe(entry => Console.WriteLine($"Happy birthday to {entry.Entity.Name}!"));

Remarks

Specifying a DbContext type with DbObservable<T> will constrain events to entities in a DbContext instance of that type.

Events provided by this library and the library which supports it (EntityFramework.Triggers) are co-variant. You can use a base class as T in DbObservable<T> and the events will be raised as expected.

Contributing

  1. Create an issue
  2. Let's find some point of agreement on your suggestion.
  3. Fork it!
  4. Create your feature branch: git checkout -b my-new-feature
  5. Commit your changes: git commit -am 'Add some feature'
  6. Push to the branch: git push origin my-new-feature
  7. Submit a pull request :D

History

Commit history

License

MIT License