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
- LocalBuilder.cs
- SettingsPropertyNotFoundException.cs
- TaiwanCalendar.cs
- UITypeEditor.cs
- DoubleLinkList.cs
- DockProviderWrapper.cs
- IntegrationExceptionEventArgs.cs
- TreeViewBindingsEditorForm.cs
- EntityAdapter.cs
- rsa.cs
- Calendar.cs
- ControlIdConverter.cs
- OdbcConnection.cs
- BufferedGraphicsContext.cs
- NavigationHelper.cs
- StreamingContext.cs
- NamespaceMapping.cs
- InkCanvasFeedbackAdorner.cs
- ImportCatalogPart.cs
- KeyPullup.cs
- KnownTypesHelper.cs
- WindowInteropHelper.cs
- WindowsRichEdit.cs
- RectIndependentAnimationStorage.cs
- AffineTransform3D.cs
- WebPartTransformer.cs
- DictionaryEntry.cs
- InfoCardConstants.cs
- ArglessEventHandlerProxy.cs
- ByteStorage.cs
- Propagator.cs
- RemotingConfigParser.cs
- AnimationClock.cs
- StorageRoot.cs
- IsolatedStoragePermission.cs
- FunctionImportMapping.cs
- MeshGeometry3D.cs
- X509ScopedServiceCertificateElementCollection.cs
- RequestCachePolicyConverter.cs
- FontDifferentiator.cs
- XmlQueryContext.cs
- TextInfo.cs
- BamlBinaryWriter.cs
- GatewayIPAddressInformationCollection.cs
- Animatable.cs
- AutoCompleteStringCollection.cs
- ClassicBorderDecorator.cs
- IgnoreFlushAndCloseStream.cs
- XmlWriterTraceListener.cs
- IIS7UserPrincipal.cs
- XPathArrayIterator.cs
- WsrmMessageInfo.cs
- WrapPanel.cs
- WebPermission.cs
- InertiaExpansionBehavior.cs
- Ref.cs
- DialogWindow.cs
- DataServiceEntityAttribute.cs
- IISMapPath.cs
- COM2PropertyPageUITypeConverter.cs
- _ConnectionGroup.cs
- documentsequencetextview.cs
- NamespaceInfo.cs
- CapabilitiesState.cs
- ToolTip.cs
- oledbmetadatacolumnnames.cs
- PrintDialog.cs
- ManifestResourceInfo.cs
- SafeNativeMethods.cs
- FormViewRow.cs
- RijndaelManagedTransform.cs
- InternalResources.cs
- CellCreator.cs
- ExitEventArgs.cs
- CanExecuteRoutedEventArgs.cs
- BatchParser.cs
- PersonalizationProviderHelper.cs
- CurrencyManager.cs
- DataGridViewCellCollection.cs
- LoginStatusDesigner.cs
- BufferedGraphicsContext.cs
- SamlSerializer.cs
- PeerNameRecordCollection.cs
- ShaperBuffers.cs
- SQlBooleanStorage.cs
- Debug.cs
- StringAnimationUsingKeyFrames.cs
- SerTrace.cs
- DrawingContextDrawingContextWalker.cs
- SafeNativeMethodsOther.cs
- QuaternionKeyFrameCollection.cs
- AggregationMinMaxHelpers.cs
- ZoneLinkButton.cs
- ChangeToolStripParentVerb.cs
- SortedList.cs
- Underline.cs
- MD5.cs
- RSAPKCS1SignatureFormatter.cs
- QuaternionRotation3D.cs
- DBConcurrencyException.cs