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
- ListSortDescription.cs
- CompiledXpathExpr.cs
- GridToolTip.cs
- _SslSessionsCache.cs
- Ipv6Element.cs
- ParagraphVisual.cs
- HttpConfigurationContext.cs
- CachedBitmap.cs
- StyleCollection.cs
- XsltConvert.cs
- C14NUtil.cs
- Pair.cs
- CaseInsensitiveComparer.cs
- SQLDateTimeStorage.cs
- BuildProvider.cs
- ColorConverter.cs
- OperandQuery.cs
- ISessionStateStore.cs
- MethodExpression.cs
- ModelUIElement3D.cs
- Rotation3DAnimationUsingKeyFrames.cs
- ResXBuildProvider.cs
- AliasedSlot.cs
- CodeSubDirectoriesCollection.cs
- NullableDecimalAverageAggregationOperator.cs
- DocumentViewerBaseAutomationPeer.cs
- SecurityPolicySection.cs
- BrowserTree.cs
- BamlResourceDeserializer.cs
- EncodingDataItem.cs
- HtmlUtf8RawTextWriter.cs
- TaskDesigner.cs
- DelimitedListTraceListener.cs
- ArithmeticException.cs
- DocumentViewerBase.cs
- StackBuilderSink.cs
- ProcessProtocolHandler.cs
- SecurityDocument.cs
- ToolStripDropDownMenu.cs
- HtmlElement.cs
- Parsers.cs
- PathData.cs
- ExecutedRoutedEventArgs.cs
- ViewManager.cs
- ListViewCommandEventArgs.cs
- DesignTimeParseData.cs
- Evidence.cs
- XmlSignatureProperties.cs
- DataBindingHandlerAttribute.cs
- NonSerializedAttribute.cs
- PropertyGridCommands.cs
- IsolatedStorage.cs
- File.cs
- RootAction.cs
- ReadOnlyHierarchicalDataSource.cs
- ReferenceSchema.cs
- SmuggledIUnknown.cs
- FolderBrowserDialog.cs
- Activation.cs
- ServiceOperationWrapper.cs
- RoleManagerSection.cs
- CompositeDispatchFormatter.cs
- Button.cs
- StatusBar.cs
- TableLayoutStyle.cs
- WSDualHttpBindingElement.cs
- DataGridViewSortCompareEventArgs.cs
- TreeViewAutomationPeer.cs
- MenuItemCollection.cs
- SID.cs
- CodeFieldReferenceExpression.cs
- StyleReferenceConverter.cs
- AttributeQuery.cs
- DataListCommandEventArgs.cs
- GraphicsPathIterator.cs
- BasePropertyDescriptor.cs
- QualifiedCellIdBoolean.cs
- NumberSubstitution.cs
- bindurihelper.cs
- HttpListenerPrefixCollection.cs
- DataGridViewAutoSizeModeEventArgs.cs
- AbandonedMutexException.cs
- SerializerProvider.cs
- SqlDataSourceStatusEventArgs.cs
- TdsValueSetter.cs
- DSACryptoServiceProvider.cs
- SessionStateModule.cs
- TemplatePagerField.cs
- DecoderReplacementFallback.cs
- VirtualDirectoryMapping.cs
- DispatcherTimer.cs
- PieceDirectory.cs
- UnknownBitmapEncoder.cs
- PersonalizablePropertyEntry.cs
- ProcessHostConfigUtils.cs
- BitmapPalette.cs
- ConfigurationElementCollection.cs
- IResourceProvider.cs
- exports.cs
- WebPartTracker.cs