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
- GatewayDefinition.cs
- RuntimeConfigLKG.cs
- PseudoWebRequest.cs
- DeclarativeCatalogPart.cs
- StickyNoteHelper.cs
- TextRange.cs
- PageRequestManager.cs
- RefreshEventArgs.cs
- CompositeActivityDesigner.cs
- EFAssociationProvider.cs
- Soap.cs
- SelectorAutomationPeer.cs
- ContentTextAutomationPeer.cs
- IisTraceWebEventProvider.cs
- ViewCellRelation.cs
- GcSettings.cs
- TextChange.cs
- EntityRecordInfo.cs
- PassportAuthentication.cs
- HashMembershipCondition.cs
- ObjectSecurityT.cs
- UserNameServiceElement.cs
- WindowsFormsDesignerOptionService.cs
- TextBox.cs
- ClientConfigPaths.cs
- ItemCheckedEvent.cs
- EntryPointNotFoundException.cs
- SQLString.cs
- ConfigXmlText.cs
- ProfileInfo.cs
- __Filters.cs
- DiscoveryOperationContext.cs
- TextBoxDesigner.cs
- StyleTypedPropertyAttribute.cs
- NamedPipeConnectionPoolSettingsElement.cs
- MobileControlPersister.cs
- TextUtf8RawTextWriter.cs
- ReflectionTypeLoadException.cs
- ArrayConverter.cs
- BrowserInteropHelper.cs
- EventLogConfiguration.cs
- DesignerVerbCollection.cs
- NameValueCollection.cs
- RoutedEventConverter.cs
- HtmlForm.cs
- GlyphRunDrawing.cs
- HttpCacheParams.cs
- ResizeGrip.cs
- Task.cs
- LockedBorderGlyph.cs
- ControlTemplate.cs
- ResXFileRef.cs
- CryptoProvider.cs
- SourceCollection.cs
- SqlFormatter.cs
- WebPartTracker.cs
- AsyncOperation.cs
- ThicknessKeyFrameCollection.cs
- SHA1Cng.cs
- columnmapkeybuilder.cs
- SizeAnimationUsingKeyFrames.cs
- PropertyToken.cs
- SelectionWordBreaker.cs
- XPathNode.cs
- CompilationLock.cs
- NonValidatingSecurityTokenAuthenticator.cs
- OperandQuery.cs
- FunctionMappingTranslator.cs
- DataGridViewIntLinkedList.cs
- BrowserDefinition.cs
- SqlDataSource.cs
- SchemaEntity.cs
- TextTreePropertyUndoUnit.cs
- OdbcEnvironment.cs
- SelectionItemProviderWrapper.cs
- SmtpNtlmAuthenticationModule.cs
- SizeFConverter.cs
- ExtendedProtectionPolicyElement.cs
- Application.cs
- PropertyStore.cs
- SerializationInfo.cs
- x509store.cs
- UnauthorizedWebPart.cs
- TextBoxAutomationPeer.cs
- SmiSettersStream.cs
- ResponseBodyWriter.cs
- SafePointer.cs
- CodeSubDirectory.cs
- SystemIPv4InterfaceProperties.cs
- SafeNativeMethodsMilCoreApi.cs
- ModelServiceImpl.cs
- ObjectSelectorEditor.cs
- StyleCollection.cs
- ThicknessAnimation.cs
- XmlElementElementCollection.cs
- ServiceDescription.cs
- FontConverter.cs
- Quad.cs
- MarkupExtensionSerializer.cs
- DataGridViewColumnConverter.cs