示例#1
0
            public ClientDatabase(SnapServerDatabase <TKey, TValue> server, SnapClient client, Action <ClientDatabaseBase> onDispose)
            {
                if ((object)server == null)
                {
                    throw new ArgumentNullException("server");
                }
                if ((object)client == null)
                {
                    throw new ArgumentNullException("client");
                }
                if ((object)onDispose == null)
                {
                    throw new ArgumentNullException("onDispose");
                }
                if (!ReferenceEquals(client, onDispose.Target))
                {
                    throw new ArgumentException("Does not reference a method in clientHost", "onDispose");
                }

                m_syncRoot    = new object();
                m_openStreams = new WeakList <SequentialReaderStream <TKey, TValue> >();
                m_server      = server;
                m_client      = (SnapServer.Client)client;
                m_onDispose   = onDispose;
            }
            public ClientDatabase(SnapServerDatabase <TKey, TValue> server, SnapClient client, Action <ClientDatabaseBase> onDispose)
            {
                m_server    = server ?? throw new ArgumentNullException(nameof(server));
                m_client    = client as SnapServer.Client ?? throw new ArgumentNullException(nameof(client));
                m_onDispose = onDispose ?? throw new ArgumentNullException(nameof(onDispose));

                if (!ReferenceEquals(client, onDispose.Target))
                {
                    throw new ArgumentException("Does not reference a method in clientHost", nameof(onDispose));
                }

                m_syncRoot    = new object();
                m_openStreams = new WeakList <SequentialReaderStream <TKey, TValue> >();
            }