Search code examples
.netsqlitenosqlembedded-databaselitedb

NoSQL embedded database with data change notification callback


I am using SQLite embedded in a .Net Desktop application developed with WPF.

SQLite provides a callback for any write operation performed to the database (within the same connection) ref

In this callback, it provides the following which leads to the records being affected

  • Event (Insert /Update/Delete)
  • Table Name
  • Row Id

I am looking for a NoSQL alternative that also provides such callback and could be embedded in a desktop application targeting .Net Framework 4.8


I like the lightweight LiteDB but couldn't find data changes callback support


Solution

  • I ended up using the Realm Database.
    Realm lets register a notification handler on a specific collection. The handler receives a description of changes since the last notification. Specifically, this description consists of three lists of indices:

    • The indices of the objects that were deleted.
    • The indices of the objects that were inserted.
    • The indices of the objects that were modified.

    Another plus point of Realm over SQLite is that these change notifications are NOT limited to changes from the same connection.