Firebird以.NET发送所有事件

时间:2012-06-26 07:43:44

标签: c# .net events firebird

正常的firebird服务器是否在发起任何注册事件时发送所有已注册的事件计数?

以firebirds网站为例,我这样做:

class FirebirdListenerTest
{
    public FirebirdListenerTest()
    {
        try
        {
            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
            cs.DataSource = "localhost";
            cs.Database = "C:\\FIREBIRD\\TEST.GDB";
            cs.UserID = "SYSDBA";
            cs.Password = "masterkey";
            cs.Charset = "NONE";

            FbConnection connection = new FbConnection(cs.ToString());
            connection.Open();

            FbRemoteEvent revent = new FbRemoteEvent(connection);
            revent.AddEvents(new string[] { "text_changed", "text_inserted", "justtest_event" });

            // Add callback to the Firebird events
            revent.RemoteEventCounts += new FbRemoteEventEventHandler(EventCounts);

            // Queue events
            revent.QueueEvents();

            Console.ReadLine();
            connection.Close();
        }
        catch (Exception e)
        {
            Debug.WriteLine(e.ToString());
        }
    }

    static void EventCounts(object sender, FbRemoteEventEventArgs args)
    {
        Console.WriteLine("Event {0} has {1} counts.", args.Name, args.Counts);
    }
}

在这样的代码中,如果引发任何事件,我总是得到所有事件的计数。它应该如何运作?

1 个答案:

答案 0 :(得分:4)

是的。您可以根据Counts属性对其进行过滤,它可以是0-n。