title: How can i create a callback function in ASP.NET, which is called when database event is raised?
body: <p>I am trying to create a notification system in ASP.NET which listens for a database event and send some info to number of devices. </p>
  
  <p>This is a sample of the class that is responsible for catching the events:</p>
  
  <pre><code>    public class FbEventClass 
      {
          private static FbEventClass eventController = null;
          public static void CreateEventController(string connectionString)
          {
              if (eventController == null)
              {
                  eventController = new FbEventClass(connectionString);
                  eventController.AddListener(MessageListener);
              }
          }
  
          FbConnection connection;
          FbRemoteEvent revent;
  
          public FbEventClass(string connectionString)
          {
              connection = new FbConnection(connectionString);
              connection.Open();
  
              revent = new FbRemoteEvent(connection);
              revent.AddEvents(String[] { "TEST" });
          }
  
          public static void MessageListener(object sender, FbRemoteEventEventArgs e)
          {
              SendNotification("Message recieved");
          } 
      }
  </code></pre>
  
  <p>I create the static object from a controller:</p>
  
  <pre><code>FbEventClass.CreateEventController(dt.connectionString);
  </code></pre>
  
  <p>The problem is that the MessageListener() method is never called. If i call the controller again, the object is not null.</p>