Exemplo n.º 1
0
        private void SetDatabaseEventHandler(Database database)
        {
            DatabaseEventSet databaseEventSet = new DatabaseEventSet();

            if (databaseLast != null)
            {
                // Stop receiving events
                databaseLast.Events.StopEvents();

                // Unsubscribe to table events
                databaseLast.Events.UnsubscribeAllEvents();
            }

            databaseLast = database;

            // Subscribe to table events
            databaseEventSet.CreateTable = true;
            databaseEventSet.DropTable   = true;
            databaseEventSet.AlterTable  = true;

            database.Events.SubscribeToEvents(databaseEventSet,
                                              new ServerEventHandler(this.MyEventHandler));
            database.Events.StartEvents();
        }
Exemplo n.º 2
0
        private void SetDatabaseEventHandler(Database database)
        {
            DatabaseEventSet databaseEventSet = new DatabaseEventSet();

            if (databaseLast != null)
            {
                // Stop receiving events
                databaseLast.Events.StopEvents();

                // Unsubscribe to table events
                databaseLast.Events.UnsubscribeAllEvents();
            }

            databaseLast = database;

            // Subscribe to table events
            databaseEventSet.CreateTable = true;
            databaseEventSet.DropTable = true;
            databaseEventSet.AlterTable = true;

            database.Events.SubscribeToEvents(databaseEventSet,
                new ServerEventHandler(this.MyEventHandler));
            database.Events.StartEvents();
        }