Is there a way to be notified in .NET when data changes in the Sql Server? Like an Event?

前端 未结 2 1801
借酒劲吻你
借酒劲吻你 2021-02-05 16:34

Is there a way to bind an event to Sql Server (specially Azure) so that, when there\'s new data in a table, for instance, my .NET process will be notified?

Another optio

2条回答
  •  你的背包
    2021-02-05 16:55

    You can use SqlTableDependency

    SqlTableDependency is a generic C# component used to receive notifications when the content of a specified database table change.

    What is the difference with .NET SqlDepenency ?

    Basically, the main difference is that SqlTableDependency send events containing values for the record inserted, changed or deleted, as well as the DML operation (insert/delete/update) executed on the table: SqlDepenency doesn't tell what data was changed on the database table, they only say that something has changed.

提交回复
热议问题