コード例 #1
0
            /// <summary>
            /// Initializes a new instance of <c>CompositeChannelCredentials</c> class.
            /// The resulting credentials object will be composite of all the credentials specified as parameters.
            /// </summary>
            /// <param name="channelCredentials">channelCredentials to compose</param>
            /// <param name="callCredentials">channelCredentials to compose</param>
            public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials)
            {
                this.channelCredentials = GrpcPreconditions.CheckNotNull(channelCredentials);
                this.callCredentials    = GrpcPreconditions.CheckNotNull(callCredentials);

                if (!channelCredentials.IsComposable)
                {
                    throw new ArgumentException(string.Format("CallCredentials can't be composed with {0}. CallCredentials must be used with secure channel credentials like SslCredentials.", channelCredentials.GetType().Name));
                }
            }