Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / SqlWriter.cs / 1305376 / SqlWriter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- 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
- XmlExtensionFunction.cs
- InvalidProgramException.cs
- WmfPlaceableFileHeader.cs
- DeferredElementTreeState.cs
- TreeView.cs
- AsymmetricKeyExchangeFormatter.cs
- CornerRadiusConverter.cs
- PasswordPropertyTextAttribute.cs
- InstanceKeyView.cs
- ArcSegment.cs
- TextComposition.cs
- XamlBrushSerializer.cs
- SetIterators.cs
- Int64AnimationUsingKeyFrames.cs
- FilteredAttributeCollection.cs
- AuditLevel.cs
- DrawingImage.cs
- ActivityDesignerAccessibleObject.cs
- TableRowGroupCollection.cs
- DataSysAttribute.cs
- StoreItemCollection.Loader.cs
- MulticastIPAddressInformationCollection.cs
- DbMetaDataFactory.cs
- NameTable.cs
- relpropertyhelper.cs
- DetailsViewUpdatedEventArgs.cs
- MailDefinition.cs
- RegularExpressionValidator.cs
- DiscoveryDocumentReference.cs
- FunctionNode.cs
- ToolStripManager.cs
- AbandonedMutexException.cs
- SignatureToken.cs
- EtwTrace.cs
- SurrogateEncoder.cs
- TabRenderer.cs
- SignedXmlDebugLog.cs
- MenuAdapter.cs
- FlatButtonAppearance.cs
- RSAOAEPKeyExchangeDeformatter.cs
- Vector3DConverter.cs
- ExcludePathInfo.cs
- WebPartChrome.cs
- ColorEditor.cs
- RegularExpressionValidator.cs
- DataServiceQueryProvider.cs
- JoinSymbol.cs
- HostExecutionContextManager.cs
- XmlHierarchyData.cs
- RegionInfo.cs
- XmlAttribute.cs
- WSFederationHttpSecurity.cs
- ColorAnimation.cs
- TextureBrush.cs
- XmlSerializerFactory.cs
- WebBrowserNavigatedEventHandler.cs
- EntityDataSourceDesignerHelper.cs
- EventLog.cs
- SafeEventLogWriteHandle.cs
- BaseTemplateBuildProvider.cs
- _emptywebproxy.cs
- ArrayWithOffset.cs
- XsltLoader.cs
- BitVec.cs
- WindowsFormsHostAutomationPeer.cs
- OciHandle.cs
- RoutedUICommand.cs
- PersonalizableAttribute.cs
- WindowsFont.cs
- Knowncolors.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SourceChangedEventArgs.cs
- DataBinder.cs
- PropertyGridView.cs
- XmlWriterDelegator.cs
- DataGridItemCollection.cs
- OleDbConnection.cs
- PolyBezierSegment.cs
- TemplateBamlTreeBuilder.cs
- Publisher.cs
- BitmapFrameDecode.cs
- Command.cs
- EmbossBitmapEffect.cs
- Rfc2898DeriveBytes.cs
- DataControlLinkButton.cs
- PkcsMisc.cs
- LinearKeyFrames.cs
- CellTreeSimplifier.cs
- AuthenticationManager.cs
- HttpCachePolicyWrapper.cs
- SqlConnectionStringBuilder.cs
- LayoutTableCell.cs
- XmlObjectSerializerWriteContextComplex.cs
- MimeMapping.cs
- PreservationFileWriter.cs
- RemoteWebConfigurationHost.cs
- XmlSignatureManifest.cs
- PersistenceProviderElement.cs
- ChannelServices.cs
- KeyConverter.cs