The NOTIFY (when a table is changed) works great
See example https://www.devart.com/dotconnect/postg ... leBookmark
BUT...
How do I handle the event when the connection is lost???
I did try (but ConnectionLost in PgSqlConnection is never fired):
Code: Select all
PgSqlConnection connection = new PgSqlConnection("User Id = xxx; Password = xxx; host = xxx; Port = 5432; database = xxx;");
depend = new PgSqlDependency();
depend.OnChange += new OnChangeEventHandler(dependency_OnChange);
PgSqlCommand selectCommand = new PgSqlCommand("SELECT * FROM public.xxx", connection);
depend.AddCommandDependency(selectCommand);
//depend.CheckTimeout = 500;
connection.ConnectionLost += new ConnectionLostEventHandler(connection_ConnectionLost);
connection.Open();
depend.Start(connection);