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
- AppliesToBehaviorDecisionTable.cs
- ResourceReferenceExpressionConverter.cs
- OpacityConverter.cs
- XmlDocumentType.cs
- IisTraceWebEventProvider.cs
- NativeMethods.cs
- ToolBarTray.cs
- TimeIntervalCollection.cs
- ChannelSinkStacks.cs
- MatcherBuilder.cs
- WebPartAuthorizationEventArgs.cs
- FormsAuthenticationModule.cs
- DmlSqlGenerator.cs
- SystemParameters.cs
- DataPager.cs
- XmlSchemaObject.cs
- ConfigurationElement.cs
- ToolboxItemSnapLineBehavior.cs
- Int64Animation.cs
- DebugView.cs
- CompositeCollection.cs
- RootAction.cs
- TreeNodeBindingCollection.cs
- ParseHttpDate.cs
- TextElementEditingBehaviorAttribute.cs
- BinaryMethodMessage.cs
- HttpHandlersSection.cs
- IisHelper.cs
- regiisutil.cs
- CompilerGeneratedAttribute.cs
- WindowsFormsHostPropertyMap.cs
- AggregateNode.cs
- ContextConfiguration.cs
- SrgsRuleRef.cs
- BaseWebProxyFinder.cs
- RegistryPermission.cs
- ResourceType.cs
- CompilerErrorCollection.cs
- EmissiveMaterial.cs
- DiscoveryDocumentSearchPattern.cs
- ServiceModelConfiguration.cs
- BaseTemplateCodeDomTreeGenerator.cs
- EncryptionUtility.cs
- WebUtil.cs
- SemaphoreSecurity.cs
- RealProxy.cs
- TriggerBase.cs
- SecurityContext.cs
- StatusBarAutomationPeer.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- UpdateProgress.cs
- CompilationAssemblyInstallComponent.cs
- SoapEnvelopeProcessingElement.cs
- PolicyUtility.cs
- IInstanceTable.cs
- safex509handles.cs
- CodeIdentifiers.cs
- RuntimeWrappedException.cs
- TextEndOfParagraph.cs
- MetadataHelper.cs
- TransportDefaults.cs
- SqlBooleanMismatchVisitor.cs
- ClickablePoint.cs
- WebPartDescription.cs
- TextEditorLists.cs
- ConfigXmlWhitespace.cs
- LineMetrics.cs
- ToolStripItemRenderEventArgs.cs
- TdsParserHelperClasses.cs
- CharEnumerator.cs
- TextWriter.cs
- NavigationProperty.cs
- MetadataArtifactLoaderCompositeFile.cs
- ActivityCodeDomSerializationManager.cs
- InfoCardBaseException.cs
- BasicKeyConstraint.cs
- XmlSchemaValidator.cs
- ToolStripScrollButton.cs
- SvcFileManager.cs
- ToolStrip.cs
- ApplicationException.cs
- SiteMapHierarchicalDataSourceView.cs
- AlternationConverter.cs
- StrokeFIndices.cs
- ListContractAdapter.cs
- EventPrivateKey.cs
- ResourceDescriptionAttribute.cs
- SchemaElementDecl.cs
- DesignerSerializerAttribute.cs
- HttpListenerResponse.cs
- ProtocolsInstallComponent.cs
- PersistencePipeline.cs
- IndentTextWriter.cs
- UnknownBitmapEncoder.cs
- EpmCustomContentWriterNodeData.cs
- EntitySetDataBindingList.cs
- TimerEventSubscriptionCollection.cs
- AnchoredBlock.cs
- LinkedResourceCollection.cs
- DataSourceProvider.cs