If 100 rows are inserted in a table then only one call should be sent to get the values.
public static void InitiateSQLTableDependency()
{
try
{
var mapper = new ModelToTableMapper<DeviceValuesProperties>();
mapper.AddMapping(deviceValue => deviceValue.DeviceId, "DeviceId");
mapper.AddMapping(deviceValue => deviceValue.TimeStamp, "TimeStamp");
tableDependency = new SqlTableDependency<DeviceValuesProperties>(connectionString, "DeviceValues", mapper);
tableDependency.OnChanged += OnDependencyChange;
tableDependency.OnError += OnDependencyError;
tableDependency.Start();
isSQLDependencyStart = true;
}
catch (Exception exception)
{
throw exception;
}
}
Sadly it doesn't work like that (assuming you are using this lib [ https://github.com/christiandelbianco/monitor-table-change-with-sqltabledependency] or even the standard SqlDependency. How often do you want this to fire? Every 100 rows? or every x time units? Why not just poll the table every so often? If you want it automatic but in bulk - You should look into either CDC, CDT or writing a trigger yourself;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.