Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------- //// 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
- CqlIdentifiers.cs
- InvokeDelegate.cs
- AttributeCollection.cs
- LateBoundBitmapDecoder.cs
- mediaclock.cs
- HttpModuleAction.cs
- ChannelCredentials.cs
- ListViewInsertedEventArgs.cs
- ObjectContextServiceProvider.cs
- ButtonBase.cs
- FullTrustAssembliesSection.cs
- ConfigPathUtility.cs
- GridItem.cs
- PageThemeParser.cs
- ModelItem.cs
- SymbolPair.cs
- EmissiveMaterial.cs
- RefreshEventArgs.cs
- IsolatedStorageFileStream.cs
- SystemIPGlobalProperties.cs
- X509Utils.cs
- KeySpline.cs
- SimpleType.cs
- CategoriesDocumentFormatter.cs
- SessionStateItemCollection.cs
- SecurityManager.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- EncoderNLS.cs
- SchemaNames.cs
- PrimarySelectionAdorner.cs
- CapiNative.cs
- DataTemplateSelector.cs
- StrokeCollectionConverter.cs
- StreamWithDictionary.cs
- AuthenticationService.cs
- ExceptionHandlers.cs
- Guid.cs
- BehaviorEditorPart.cs
- WindowsTooltip.cs
- SafeNativeMethods.cs
- ExportException.cs
- AppDomainFactory.cs
- RegexCapture.cs
- SystemWebSectionGroup.cs
- FormattedTextSymbols.cs
- SigningProgress.cs
- ElementNotEnabledException.cs
- MdiWindowListStrip.cs
- Annotation.cs
- MatrixKeyFrameCollection.cs
- EmptyWithCancelationCheckWorkItem.cs
- BinHexDecoder.cs
- XomlCompilerResults.cs
- TriggerCollection.cs
- LookupNode.cs
- RelationshipNavigation.cs
- VisualSerializer.cs
- WebEventCodes.cs
- __ConsoleStream.cs
- Codec.cs
- ConnectionInterfaceCollection.cs
- CommandID.cs
- OleDbPropertySetGuid.cs
- DocumentViewerHelper.cs
- dbdatarecord.cs
- Utilities.cs
- ItemChangedEventArgs.cs
- ILGen.cs
- IntAverageAggregationOperator.cs
- FormsAuthenticationConfiguration.cs
- RectangleConverter.cs
- HtmlToClrEventProxy.cs
- WebPartChrome.cs
- login.cs
- Range.cs
- MethodCallConverter.cs
- EdgeModeValidation.cs
- NameValuePair.cs
- DrawingContextWalker.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- DataGridViewRowEventArgs.cs
- ListBase.cs
- IChannel.cs
- AliasedSlot.cs
- XmlMtomWriter.cs
- ComplexObject.cs
- IsolatedStorageFile.cs
- ProfessionalColorTable.cs
- EnumBuilder.cs
- PassportAuthentication.cs
- StaticTextPointer.cs
- SecurityUtils.cs
- SignedXml.cs
- MetadataStore.cs
- ColorTranslator.cs
- ApplicationId.cs
- CodeActivity.cs
- ParseNumbers.cs
- SecurityTokenResolver.cs
- RequestResponse.cs