claylaut / EntityFramework.Rx

Reactive extension wrappers for *hot* observables of Entity Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EntityFramework.Rx

Reactive extension wrappers for hot observables of Entity Framework entities.

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

Installation

Simply install the NuGet package for EF6 or EF Core

EF version .NET support NuGet package
6.1.3 >= 4.6.1 NuGet Status
Core 2.0 >= 4.6.1 || >= Standard 2.0 NuGet Status

Usage

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

  • FromInserting
  • FromInsertFailed
  • FromInserted
  • FromUpdating
  • FromUpdated
  • FromUpdateFailed
  • FromDeleting
  • FromDeleted
  • FromDeleteFailed
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 contrain 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

About

Reactive extension wrappers for *hot* observables of Entity Framework

License:MIT License


Languages

Language:C# 100.0%