Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / SqlWriter.cs / 2 / SqlWriter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using System.Data.SqlClient; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; namespace System.Data.SqlClient.SqlGen { ////// This extends StringWriter primarily to add the ability to add an indent /// to each line that is written out. /// class SqlWriter : StringWriter { // We start at -1, since the first select statement will increment it to 0. int indent = -1; ////// The number of tabs to be added at the beginning of each new line. /// internal int Indent { get { return indent; } set { indent = value; } } bool atBeginningOfLine = true; ////// /// /// public SqlWriter(StringBuilder b) : base(b, System.Globalization.CultureInfo.InvariantCulture) // I don't think the culture matters, but FxCop wants something { } ////// Reset atBeginningofLine if we detect the newline string. /// /// public override void Write(string value) { if (value == "\r\n") { base.WriteLine(); atBeginningOfLine = true; } else { if (atBeginningOfLine) { if (indent > 0) { base.Write(new string('\t', indent)); } atBeginningOfLine = false; } base.Write(value); } } ////// Add as many tabs as the value of indent if we are at the /// beginning of a line. /// /// /// public override void WriteLine() { base.WriteLine(); atBeginningOfLine = true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using System.Data.SqlClient; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; namespace System.Data.SqlClient.SqlGen { ////// This extends StringWriter primarily to add the ability to add an indent /// to each line that is written out. /// class SqlWriter : StringWriter { // We start at -1, since the first select statement will increment it to 0. int indent = -1; ////// The number of tabs to be added at the beginning of each new line. /// internal int Indent { get { return indent; } set { indent = value; } } bool atBeginningOfLine = true; ////// /// /// public SqlWriter(StringBuilder b) : base(b, System.Globalization.CultureInfo.InvariantCulture) // I don't think the culture matters, but FxCop wants something { } ////// Reset atBeginningofLine if we detect the newline string. /// /// public override void Write(string value) { if (value == "\r\n") { base.WriteLine(); atBeginningOfLine = true; } else { if (atBeginningOfLine) { if (indent > 0) { base.Write(new string('\t', indent)); } atBeginningOfLine = false; } base.Write(value); } } ////// Add as many tabs as the value of indent if we are at the /// beginning of a line. /// /// /// public override void WriteLine() { base.WriteLine(); atBeginningOfLine = true; } } } // 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
- HMACSHA256.cs
- WebBrowserUriTypeConverter.cs
- ReaderWriterLock.cs
- PersonalizationDictionary.cs
- Transform3D.cs
- ConsoleCancelEventArgs.cs
- ProtocolsConfigurationEntry.cs
- PointIndependentAnimationStorage.cs
- Int32CAMarshaler.cs
- Latin1Encoding.cs
- WebConvert.cs
- HttpCookiesSection.cs
- BlurBitmapEffect.cs
- Win32.cs
- MemberJoinTreeNode.cs
- EndSelectCardRequest.cs
- PanelStyle.cs
- SecurityKeyType.cs
- OuterGlowBitmapEffect.cs
- XmlDataImplementation.cs
- ImportCatalogPart.cs
- SoapRpcMethodAttribute.cs
- ConfigurationStrings.cs
- CultureTableRecord.cs
- DataColumnChangeEvent.cs
- ValueUnavailableException.cs
- ExtractCollection.cs
- TCPClient.cs
- SQLConvert.cs
- MarginCollapsingState.cs
- WebPartZoneCollection.cs
- ComponentTray.cs
- HwndTarget.cs
- PromptEventArgs.cs
- ConfigurationSectionHelper.cs
- CancellationToken.cs
- RemotingConfigParser.cs
- DllNotFoundException.cs
- ToolStripProgressBar.cs
- XmlWriterSettings.cs
- SettingsSavedEventArgs.cs
- ProviderManager.cs
- MatrixAnimationUsingKeyFrames.cs
- SqlConnectionPoolGroupProviderInfo.cs
- KeysConverter.cs
- MethodBuilderInstantiation.cs
- GeometryCollection.cs
- ComponentDispatcher.cs
- SafeCoTaskMem.cs
- TraceListeners.cs
- DataTransferEventArgs.cs
- TemplateControlParser.cs
- ToolStripDropDownClosedEventArgs.cs
- RuntimeResourceSet.cs
- SqlAliaser.cs
- AuthenticationServiceManager.cs
- ColumnHeaderConverter.cs
- SerializationFieldInfo.cs
- SafeRightsManagementHandle.cs
- HtmlImage.cs
- TextDocumentView.cs
- Vector3DKeyFrameCollection.cs
- DataServiceResponse.cs
- DataBoundControlActionList.cs
- SmuggledIUnknown.cs
- MetadataItemSerializer.cs
- SqlGatherProducedAliases.cs
- ConsoleTraceListener.cs
- XhtmlMobileTextWriter.cs
- BasicCellRelation.cs
- PrivateFontCollection.cs
- DesigntimeLicenseContext.cs
- TypedReference.cs
- FontSource.cs
- DoubleAverageAggregationOperator.cs
- AsnEncodedData.cs
- FlowDecisionLabelFeature.cs
- _Rfc2616CacheValidators.cs
- InvalidCommandTreeException.cs
- DateTime.cs
- DataGridItem.cs
- TextBox.cs
- _TimerThread.cs
- TextChange.cs
- BCryptHashAlgorithm.cs
- RemotingException.cs
- BitmapEffectDrawingContextWalker.cs
- DrawingContextWalker.cs
- TypeToTreeConverter.cs
- SvcMapFileSerializer.cs
- EncoderExceptionFallback.cs
- HandleTable.cs
- HostedTcpTransportManager.cs
- ReadOnlyActivityGlyph.cs
- ToolTip.cs
- Exceptions.cs
- DataColumn.cs
- CompressionTracing.cs
- ItemsPresenter.cs
- NonceCache.cs