c# - SqlDependencyEx event inside Controller not getting fired -


i´m trying use sqldependencyex problem ondatachange event not getting fired inside controller, enabled service broker. here´s code:

    private const string connection_string = "server=lftcmcptp83;database=database;trusted_connection=true;multipleactiveresultsets=true; integrated security=false;user id=used_id;password=password";     private const string database_name = "db_name";     private const string table_name = "table_name";     private const string schema_name = "dbo";     private sqldependencyex sqldependency = new sqldependencyex(connection_string, database_name,     table_name, schema_name);     private void registernotification()     {         sqldependency.tablechanged += ondatachange;         sqldependency.start();     }     private void ondatachange(object sender, sqldependencyex.tablechangedeventargs e)     {         //code     }     public iactionresult create(){          registernotification();     } 

best regards

problem solved, here´s code:

private const string connection_string = "server=lftcmcptp83;database=database;trusted_connection=true;multipleactiveresultsets=true; integrated security=false;user id=used_id;password=password"; private const string database_name = "db_name"; private const string table_name = "table_name"; private const string schema_name = "dbo"; private sqldependencyex sqldependency = new sqldependencyex(connection_string, database_name, table_name, schema_name); listener.tablechanged += (o, args) => {    //code... }; listener.start(); listener.stop(); 

best regards


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -