Example #1
0
        /// <summary>
        /// Validates that an implementation of IDataServiceStreamProvider2 exists and loads it.
        /// </summary>
        /// <returns>An instance of the IDataServiceStreamProvider2 interface.</returns>
        internal IDataServiceStreamProvider2 LoadAndValidateStreamProvider2()
        {
            if (this.streamProvider == null)
            {
                this.LoadStreamProvider();
            }

            IDataServiceStreamProvider2 streamProvider2 = this.streamProvider as IDataServiceStreamProvider2;

            if (streamProvider2 == null)
            {
                throw new InvalidOperationException(Strings.DataServiceStreamProviderWrapper_MustImplementDataServiceStreamProvider2ToSupportNamedStreams);
            }

            return(streamProvider2);
        }
Example #2
0
        internal IDataServiceStreamProvider2 LoadAndValidateStreamProvider2()
        {
            if (this.dataService.Configuration.DataServiceBehavior.MaxProtocolVersion < DataServiceProtocolVersion.V3)
            {
                throw new InvalidOperationException(Strings.DataServiceStreamProviderWrapper_MaxProtocolVersionMustBeV3OrAboveToSupportNamedStreams);
            }
            if (this.streamProvider == null)
            {
                this.LoadStreamProvider();
            }
            IDataServiceStreamProvider2 streamProvider = this.streamProvider as IDataServiceStreamProvider2;

            if (streamProvider == null)
            {
                throw new InvalidOperationException(Strings.DataServiceStreamProviderWrapper_MustImplementDataServiceStreamProvider2ToSupportNamedStreams);
            }
            return(streamProvider);
        }