Exemplo n.º 1
0
        // methods
        public bool Execute(IWriteBinding binding, CancellationToken cancellationToken)
        {
            using (var channelSource = binding.GetWriteChannelSource(cancellationToken))
                using (var channel = channelSource.GetChannel(cancellationToken))
                    using (var channelBinding = new ChannelReadWriteBinding(channelSource.Server, channel))
                    {
                        IWriteOperation <bool> operation;
                        if (channel.ConnectionDescription.ServerVersion >= __serverVersionSupportingUserManagementCommands)
                        {
                            operation = new DropUserUsingUserManagementCommandsOperation(_databaseNamespace, _username, _messageEncoderSettings);
                        }
                        else
                        {
                            operation = new DropUserUsingSystemUsersCollectionOperation(_databaseNamespace, _username, _messageEncoderSettings);
                        }

                        return(operation.Execute(channelBinding, cancellationToken));
                    }
        }