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
- SqlUserDefinedTypeAttribute.cs
- GenericWebPart.cs
- HtmlFormWrapper.cs
- FragmentQueryProcessor.cs
- AudioSignalProblemOccurredEventArgs.cs
- TransformPatternIdentifiers.cs
- Matrix3DStack.cs
- Wildcard.cs
- Empty.cs
- SystemIPInterfaceProperties.cs
- JournalEntry.cs
- BitmapEditor.cs
- SettingsProperty.cs
- XmlDigitalSignatureProcessor.cs
- TransformDescriptor.cs
- Rules.cs
- RectAnimationUsingKeyFrames.cs
- StylusShape.cs
- __Filters.cs
- WebBrowsableAttribute.cs
- DataGridRow.cs
- InfocardInteractiveChannelInitializer.cs
- HeaderCollection.cs
- CollaborationHelperFunctions.cs
- TrustSection.cs
- BindingContext.cs
- TdsParserHelperClasses.cs
- HttpHandlerActionCollection.cs
- WebPartConnectionsEventArgs.cs
- IconHelper.cs
- ColumnBinding.cs
- XmlToDatasetMap.cs
- SecurityIdentifierElement.cs
- UIAgentMonitorHandle.cs
- SchemaImporter.cs
- Command.cs
- FactoryGenerator.cs
- EffectiveValueEntry.cs
- MessageProtectionOrder.cs
- ManifestResourceInfo.cs
- ButtonBaseAdapter.cs
- TargetParameterCountException.cs
- Base64Decoder.cs
- MLangCodePageEncoding.cs
- StringComparer.cs
- DependsOnAttribute.cs
- PartManifestEntry.cs
- RectAnimationClockResource.cs
- ListViewAutomationPeer.cs
- Subordinate.cs
- SqlNotificationEventArgs.cs
- ObjectSet.cs
- PersistenceTypeAttribute.cs
- InvokeProviderWrapper.cs
- ResXDataNode.cs
- Misc.cs
- DataServiceHostFactory.cs
- GraphicsPathIterator.cs
- RulePatternOps.cs
- AppSettingsReader.cs
- ContextStaticAttribute.cs
- SplitContainer.cs
- _HTTPDateParse.cs
- WebPartUtil.cs
- BookmarkList.cs
- MergePropertyDescriptor.cs
- CompilerParameters.cs
- MaskedTextBoxDesigner.cs
- TypeConverterHelper.cs
- HtmlUtf8RawTextWriter.cs
- Hashtable.cs
- SiteOfOriginContainer.cs
- TableHeaderCell.cs
- EntryIndex.cs
- PersonalizationDictionary.cs
- XmlSchemaSet.cs
- SystemIPInterfaceProperties.cs
- FixedSOMTable.cs
- XmlExpressionDumper.cs
- WindowProviderWrapper.cs
- SpanIndex.cs
- DataGridViewRowCancelEventArgs.cs
- GrammarBuilderRuleRef.cs
- ProtocolViolationException.cs
- NullableConverter.cs
- PolicyException.cs
- OraclePermission.cs
- Model3DCollection.cs
- ControlOperationBehavior.cs
- EventDriven.cs
- Mapping.cs
- CorruptingExceptionCommon.cs
- SHA512Managed.cs
- ResourceDisplayNameAttribute.cs
- CompilerGeneratedAttribute.cs
- RemotingServices.cs
- ValidationResult.cs
- CustomAttributeBuilder.cs
- ItemContainerGenerator.cs
- VersionedStreamOwner.cs