Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Data / Microsoft / SqlServer / Server / SmiGettersStream.cs / 1 / SmiGettersStream.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data.Common; using System.Data.SqlClient; using System.IO; using System.Diagnostics; internal class SmiGettersStream : Stream { private SmiEventSink_Default _sink; private ITypedGettersV3 _getters; private int _ordinal; private long _readPosition; private SmiMetaData _metaData; internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) { Debug.Assert( null != sink ); Debug.Assert( null != getters ); Debug.Assert( 0 <= ordinal ); Debug.Assert( null != metaData ); _sink = sink; _getters = getters; _ordinal = ordinal; _readPosition = 0; _metaData = metaData; } public override bool CanRead { get { return true; } } // If CanSeek is false, Position, Seek, Length, and SetLength should throw. public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return false; } } public override long Length { get { return ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, 0, null, 0, 0, false ); } } public override long Position { get { return _readPosition; } set { throw SQL.StreamSeekNotSupported(); } } public override void Flush() { throw SQL.StreamWriteNotSupported(); } public override long Seek(long offset, SeekOrigin origin) { throw SQL.StreamSeekNotSupported(); } public override void SetLength(long value) { throw SQL.StreamWriteNotSupported(); } public override int Read( byte[] buffer, int offset, int count ) { long bytesRead = ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, _readPosition, buffer, offset, count, false ); _readPosition += bytesRead; return checked( (int) bytesRead ); } public override void Write( byte[] buffer, int offset, int count ) { throw SQL.StreamWriteNotSupported(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data.Common; using System.Data.SqlClient; using System.IO; using System.Diagnostics; internal class SmiGettersStream : Stream { private SmiEventSink_Default _sink; private ITypedGettersV3 _getters; private int _ordinal; private long _readPosition; private SmiMetaData _metaData; internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) { Debug.Assert( null != sink ); Debug.Assert( null != getters ); Debug.Assert( 0 <= ordinal ); Debug.Assert( null != metaData ); _sink = sink; _getters = getters; _ordinal = ordinal; _readPosition = 0; _metaData = metaData; } public override bool CanRead { get { return true; } } // If CanSeek is false, Position, Seek, Length, and SetLength should throw. public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return false; } } public override long Length { get { return ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, 0, null, 0, 0, false ); } } public override long Position { get { return _readPosition; } set { throw SQL.StreamSeekNotSupported(); } } public override void Flush() { throw SQL.StreamWriteNotSupported(); } public override long Seek(long offset, SeekOrigin origin) { throw SQL.StreamSeekNotSupported(); } public override void SetLength(long value) { throw SQL.StreamWriteNotSupported(); } public override int Read( byte[] buffer, int offset, int count ) { long bytesRead = ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, _readPosition, buffer, offset, count, false ); _readPosition += bytesRead; return checked( (int) bytesRead ); } public override void Write( byte[] buffer, int offset, int count ) { throw SQL.StreamWriteNotSupported(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeDelegateInvokeExpression.cs
- EntityDataSourceView.cs
- _SslSessionsCache.cs
- validationstate.cs
- XpsFontSerializationService.cs
- CodeNamespace.cs
- UDPClient.cs
- KeyedQueue.cs
- SerializationInfoEnumerator.cs
- SimpleTypesSurrogate.cs
- WorkflowOperationBehavior.cs
- codemethodreferenceexpression.cs
- ObjectQueryExecutionPlan.cs
- DataSourceCacheDurationConverter.cs
- FormClosingEvent.cs
- NullableDoubleMinMaxAggregationOperator.cs
- EncoderReplacementFallback.cs
- BooleanAnimationBase.cs
- SqlDataSourceCache.cs
- TimeoutHelper.cs
- ImageAnimator.cs
- XmlElementAttributes.cs
- XNameTypeConverter.cs
- PointCollectionConverter.cs
- EventLogLink.cs
- FunctionQuery.cs
- ObjectDataSourceSelectingEventArgs.cs
- TypeElement.cs
- PropertiesTab.cs
- EventProviderWriter.cs
- Size.cs
- InvalidAsynchronousStateException.cs
- ThicknessConverter.cs
- FontDriver.cs
- SizeChangedEventArgs.cs
- OleCmdHelper.cs
- DataObjectCopyingEventArgs.cs
- WebRequest.cs
- DistributedTransactionPermission.cs
- InternalReceiveMessage.cs
- VisualStyleElement.cs
- TextDecorationCollection.cs
- ImportException.cs
- TTSEngineTypes.cs
- RedistVersionInfo.cs
- SafeEventLogWriteHandle.cs
- AssemblyNameProxy.cs
- GroupStyle.cs
- SmtpCommands.cs
- SymbolPair.cs
- HandlerMappingMemo.cs
- NavigatorOutput.cs
- MulticastNotSupportedException.cs
- TraceInternal.cs
- SpecialNameAttribute.cs
- InteropAutomationProvider.cs
- SafeHandle.cs
- IChannel.cs
- InputMethod.cs
- BamlStream.cs
- ClientUrlResolverWrapper.cs
- MultiPartWriter.cs
- UpdatePanelControlTrigger.cs
- HandlerWithFactory.cs
- FlatButtonAppearance.cs
- GiveFeedbackEvent.cs
- ServiceModelEnhancedConfigurationElementCollection.cs
- CompilationLock.cs
- FileDetails.cs
- SkinBuilder.cs
- RequestStatusBarUpdateEventArgs.cs
- DbProviderServices.cs
- ScheduleChanges.cs
- FactoryMaker.cs
- WorkflowQueueInfo.cs
- SettingsPropertyNotFoundException.cs
- RelatedPropertyManager.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Common.cs
- Transform.cs
- GPRECTF.cs
- WindowsGrip.cs
- UdpMessageProperty.cs
- DataListItemCollection.cs
- ResourcePermissionBase.cs
- DBPropSet.cs
- WebPartHelpVerb.cs
- XmlValidatingReaderImpl.cs
- OracleInternalConnection.cs
- StickyNoteAnnotations.cs
- Triplet.cs
- DataColumnChangeEvent.cs
- UInt64Storage.cs
- Soap.cs
- PeerContact.cs
- ClientOptions.cs
- ConfigurationPermission.cs
- PathStreamGeometryContext.cs
- DbConnectionOptions.cs
- FormViewInsertEventArgs.cs