编程语言
首页 > 编程语言> > c# – Firebird在.NET中发送所有事件

c# – Firebird在.NET中发送所有事件

作者:互联网

是否正常的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);
    }
}

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

解决方法:

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

标签:c,net,events,firebird
来源: https://codeday.me/bug/20190626/1289834.html