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
- RangeContentEnumerator.cs
- RepeaterCommandEventArgs.cs
- XmlWrappingWriter.cs
- OutputCacheProfile.cs
- DispatcherSynchronizationContext.cs
- ViewUtilities.cs
- CatalogPartChrome.cs
- SerializationSectionGroup.cs
- WebPartDescription.cs
- SqlDataSourceCache.cs
- XmlSchemaAttributeGroup.cs
- ProcessHostServerConfig.cs
- _SslStream.cs
- MbpInfo.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- CompletionCallbackWrapper.cs
- ObjectTag.cs
- XmlWellformedWriter.cs
- SqlProcedureAttribute.cs
- XmlCDATASection.cs
- ToolTip.cs
- ActionFrame.cs
- CheckBoxBaseAdapter.cs
- TypeBuilder.cs
- SQLInt16.cs
- ArrangedElement.cs
- ScriptManagerProxy.cs
- ApplicationDirectoryMembershipCondition.cs
- AssemblyInfo.cs
- ZipFileInfo.cs
- Graph.cs
- GeometryDrawing.cs
- DummyDataSource.cs
- TimeEnumHelper.cs
- CellIdBoolean.cs
- CookieProtection.cs
- HybridDictionary.cs
- FillBehavior.cs
- Rect.cs
- SourceFileBuildProvider.cs
- HttpConfigurationSystem.cs
- InvalidFilterCriteriaException.cs
- Utils.cs
- NetworkInterface.cs
- DeclarativeCatalogPart.cs
- ConfigurationValidatorAttribute.cs
- LinkDescriptor.cs
- ListViewTableCell.cs
- XmlException.cs
- PixelFormats.cs
- CommonGetThemePartSize.cs
- RegistryDataKey.cs
- GridErrorDlg.cs
- HttpWriter.cs
- TypeSchema.cs
- XmlSchemaChoice.cs
- GlyphsSerializer.cs
- Substitution.cs
- AuthenticodeSignatureInformation.cs
- AspCompat.cs
- InternalConfigEventArgs.cs
- DrawingState.cs
- NonVisualControlAttribute.cs
- TextParagraphCache.cs
- DataBoundControlAdapter.cs
- AspNetPartialTrustHelpers.cs
- ExecutionTracker.cs
- CompilerGlobalScopeAttribute.cs
- SchemaComplexType.cs
- SerialStream.cs
- LeafCellTreeNode.cs
- Rectangle.cs
- Math.cs
- Conditional.cs
- Cursor.cs
- GZipObjectSerializer.cs
- EdmEntityTypeAttribute.cs
- DefaultObjectMappingItemCollection.cs
- WorkflowRuntimeServiceElement.cs
- Int16Converter.cs
- ExecutionScope.cs
- PageCopyCount.cs
- IdentityNotMappedException.cs
- DBNull.cs
- RealizationDrawingContextWalker.cs
- XmlElementList.cs
- RuntimeComponentFilter.cs
- ColorIndependentAnimationStorage.cs
- HMACSHA1.cs
- DesignerDataConnection.cs
- TextDecorations.cs
- BamlStream.cs
- XmlKeywords.cs
- CatalogPart.cs
- UnsettableComboBox.cs
- AutomationPropertyInfo.cs
- WindowShowOrOpenTracker.cs
- SHA256.cs
- Compilation.cs
- WindowsTitleBar.cs