SQLDependency on a MariaDB/MySQL database

2019-08-29 13:40发布

问题:

I developed a web dashboard that needs to display real-time information (ASP.NET C #). Usually I use SQLServer, so the combination SignalR + SQLDependency works very well. But now I have to use a MariaDB / MySQL database and I can not find a library equivalent to SQLDependency. Is there a "trick" for notifying a change in a database?

I found this library : https://www.devart.com/dotconnect/mysql/docs/Devart.Data.MySql~Devart.Data.MySql.MySqlDependency.html but it's not free ...

回答1:

In MySQL, you could potentially utilize a trigger and a user-defined function (UDF).

Another option would be MySqlDependency, however I believe that would require a purchased driver:

https://dev.mysql.com/doc/refman/8.0/en/create-trigger.html

https://www.devart.com/dbx/mysql/