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
- TypeBuilder.cs
- EventLogPermissionEntryCollection.cs
- ComponentManagerBroker.cs
- TextMetrics.cs
- ParameterCollection.cs
- TCEAdapterGenerator.cs
- TypedDataSourceCodeGenerator.cs
- FacetEnabledSchemaElement.cs
- COM2ExtendedUITypeEditor.cs
- wgx_render.cs
- DetailsViewDesigner.cs
- EntityDataSourceMemberPath.cs
- RoleManagerSection.cs
- RemotingException.cs
- ProfileService.cs
- InheritedPropertyChangedEventArgs.cs
- _StreamFramer.cs
- StylusButton.cs
- Profiler.cs
- FamilyMapCollection.cs
- DrawingVisualDrawingContext.cs
- RectValueSerializer.cs
- Image.cs
- DoubleAverageAggregationOperator.cs
- AccessibleObject.cs
- XmlSchemaSimpleContent.cs
- HtmlToClrEventProxy.cs
- BinaryWriter.cs
- SamlAuthorityBinding.cs
- StyleHelper.cs
- SpStreamWrapper.cs
- VisualBasicValue.cs
- RequiredArgumentAttribute.cs
- EndPoint.cs
- FileDetails.cs
- HtmlDocument.cs
- SQLRoleProvider.cs
- FormsAuthenticationUserCollection.cs
- EdmProviderManifest.cs
- ImageUrlEditor.cs
- CompilationLock.cs
- Helpers.cs
- ElementsClipboardData.cs
- WindowsRegion.cs
- fixedPageContentExtractor.cs
- PartialCachingControl.cs
- SqlHelper.cs
- UnsafeMethods.cs
- AddInStore.cs
- GatewayDefinition.cs
- SortKey.cs
- HtmlInputReset.cs
- InputQueue.cs
- BindingSource.cs
- InputScopeConverter.cs
- TraceRecord.cs
- TouchDevice.cs
- UpdateTracker.cs
- WebPartUserCapability.cs
- Empty.cs
- MetaType.cs
- InstanceKeyNotReadyException.cs
- ErrorStyle.cs
- KeyboardNavigation.cs
- Logging.cs
- LoadWorkflowByKeyAsyncResult.cs
- StaticExtension.cs
- ValidationPropertyAttribute.cs
- ConstraintEnumerator.cs
- ScrollContentPresenter.cs
- ApplyImportsAction.cs
- ProxyGenerationError.cs
- SafeRightsManagementHandle.cs
- StyleModeStack.cs
- AppModelKnownContentFactory.cs
- InkCanvasSelectionAdorner.cs
- PropertyChangeTracker.cs
- ResourcesGenerator.cs
- DrawTreeNodeEventArgs.cs
- StrongBox.cs
- ViewSimplifier.cs
- SharedPersonalizationStateInfo.cs
- NameScope.cs
- ByteStreamMessageEncoder.cs
- StateBag.cs
- PngBitmapDecoder.cs
- glyphs.cs
- RuleSettings.cs
- SqlAggregateChecker.cs
- StringFormat.cs
- EventLogPermissionEntry.cs
- Currency.cs
- DbTransaction.cs
- LayoutUtils.cs
- TableItemStyle.cs
- FileRecordSequenceHelper.cs
- NetworkInterface.cs
- XmlSchemaObjectCollection.cs
- PeerPresenceInfo.cs
- TextElement.cs