问题描述
我开发了一个需要显示实时信息的 Web 仪表板 (ASP.NET C#).通常我使用 SQLServer,所以 SignalR + SQLDependency 的组合效果很好.但是现在我必须使用 MariaDB/MySQL 数据库,我找不到与 SQLDependency 等效的库.通知数据库更改是否有技巧"?
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?
我找到了这个库:https://www.devart.com/dotconnect/mysql/docs/Devart.Data.MySql~Devart.Data.MySql.MySqlDependency.html 但它不是免费的......
I found this library : https://www.devart.com/dotconnect/mysql/docs/Devart.Data.MySql~Devart.Data.MySql.MySqlDependency.html but it's not free ...
推荐答案
在 MySQL 中,您可能会利用触发器和用户定义函数 (UDF).
In MySQL, you could potentially utilize a trigger and a user-defined function (UDF).
另一个选项是 MySqlDependency,但我认为这需要购买驱动程序:
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/
这篇关于MariaDB/MySQL 数据库上的 SQLDependency的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!