Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / SqlWriter.cs / 1 / 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
- DynamicValidator.cs
- WinEventHandler.cs
- XmlHierarchicalDataSourceView.cs
- BrowserDefinitionCollection.cs
- ChangeTracker.cs
- ReadOnlyDataSourceView.cs
- PropertyPath.cs
- NotifyIcon.cs
- MissingMethodException.cs
- XmlnsPrefixAttribute.cs
- BamlBinaryReader.cs
- XmlCharType.cs
- HtmlTextViewAdapter.cs
- SelectingProviderEventArgs.cs
- RegularExpressionValidator.cs
- KeyEventArgs.cs
- Visitors.cs
- ObjectKeyFrameCollection.cs
- StatusBarPanelClickEvent.cs
- BitmapEffectrendercontext.cs
- IsolatedStoragePermission.cs
- DataPointer.cs
- BaseDataBoundControl.cs
- WindowShowOrOpenTracker.cs
- GlyphElement.cs
- DelegateBodyWriter.cs
- SplineKeyFrames.cs
- WebPartDisplayMode.cs
- MonthChangedEventArgs.cs
- ListBase.cs
- ResourceCodeDomSerializer.cs
- SerializationEventsCache.cs
- SchemaInfo.cs
- FixedBufferAttribute.cs
- TextEffectResolver.cs
- compensatingcollection.cs
- DataGridHeaderBorder.cs
- WeakReferenceList.cs
- XsdCachingReader.cs
- MULTI_QI.cs
- ClientSideQueueItem.cs
- DataGridViewCellPaintingEventArgs.cs
- GAC.cs
- InfoCardProofToken.cs
- ButtonBaseAdapter.cs
- PageParserFilter.cs
- FixedSOMLineRanges.cs
- BlurBitmapEffect.cs
- ModelUIElement3D.cs
- SecurityRuntime.cs
- MenuRendererClassic.cs
- XappLauncher.cs
- ArithmeticException.cs
- COM2Properties.cs
- ViewgenGatekeeper.cs
- AlphabeticalEnumConverter.cs
- IconHelper.cs
- InvokeWebServiceDesigner.cs
- FormsAuthenticationUser.cs
- BitmapCodecInfo.cs
- CellParaClient.cs
- AnnotationResource.cs
- XmlRawWriter.cs
- XDRSchema.cs
- InvalidOperationException.cs
- CapabilitiesRule.cs
- TypeElement.cs
- DataGridViewTopLeftHeaderCell.cs
- ByteStreamMessageEncodingElement.cs
- TextEditorTables.cs
- DataGridViewCellEventArgs.cs
- CriticalFileToken.cs
- LOSFormatter.cs
- ParameterCollection.cs
- FileUtil.cs
- _ProxyRegBlob.cs
- DispatcherObject.cs
- HttpRuntimeSection.cs
- RecognizerStateChangedEventArgs.cs
- Panel.cs
- RealizationContext.cs
- SQLMembershipProvider.cs
- SqlVisitor.cs
- ReadOnlyActivityGlyph.cs
- DataRowView.cs
- SiteMapDataSource.cs
- LayoutDump.cs
- _SafeNetHandles.cs
- SelectionListComponentEditor.cs
- TextureBrush.cs
- XmlSchemaInfo.cs
- AuthenticateEventArgs.cs
- AppDomainAttributes.cs
- XpsSerializationException.cs
- ToolStripLocationCancelEventArgs.cs
- TextServicesCompartmentEventSink.cs
- TargetConverter.cs
- EntityDataSourceStatementEditorForm.cs
- NonBatchDirectoryCompiler.cs
- SourceFileBuildProvider.cs