Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ObjectFullSpanRewriter.cs
- FileSystemEventArgs.cs
- TextTreeUndo.cs
- AuthenticatedStream.cs
- FamilyMapCollection.cs
- WizardSideBarListControlItem.cs
- DataView.cs
- HealthMonitoringSectionHelper.cs
- DataGridViewColumnCollectionEditor.cs
- EventDescriptorCollection.cs
- UnsafeNativeMethods.cs
- SoapAttributeAttribute.cs
- ListBoxAutomationPeer.cs
- ThreadPool.cs
- ByteStorage.cs
- BitmapFrameEncode.cs
- PolicyChain.cs
- CompilerError.cs
- EventWaitHandle.cs
- DataKeyPropertyAttribute.cs
- ToolStripDropDownClosedEventArgs.cs
- Crc32.cs
- OrderByBuilder.cs
- LinkLabelLinkClickedEvent.cs
- DataColumnMapping.cs
- DependencyPropertyAttribute.cs
- KnownTypesProvider.cs
- XmlSerializerFactory.cs
- SettingsContext.cs
- SafeFileMappingHandle.cs
- TemplateKeyConverter.cs
- IPAddress.cs
- GridProviderWrapper.cs
- Version.cs
- GZipStream.cs
- RIPEMD160.cs
- XmlSchemaChoice.cs
- DataGridHeaderBorder.cs
- Attributes.cs
- BulletDecorator.cs
- DefaultProxySection.cs
- MetadataProperty.cs
- QueryResultOp.cs
- NotifyParentPropertyAttribute.cs
- VisualBrush.cs
- LingerOption.cs
- Evidence.cs
- XmlSchemaObject.cs
- UIServiceHelper.cs
- XDRSchema.cs
- COAUTHINFO.cs
- FontSizeConverter.cs
- DefaultEventAttribute.cs
- CombinedGeometry.cs
- IconBitmapDecoder.cs
- Point3DCollectionConverter.cs
- ScriptRegistrationManager.cs
- BinaryMethodMessage.cs
- TreeWalker.cs
- ControlPropertyNameConverter.cs
- sqlser.cs
- GlyphRunDrawing.cs
- ContentOperations.cs
- XsltException.cs
- IChannel.cs
- HorizontalAlignConverter.cs
- RequestDescription.cs
- SoapReflectionImporter.cs
- ResourceContainer.cs
- RepeaterItemEventArgs.cs
- ResXResourceSet.cs
- PointCollectionConverter.cs
- AlternationConverter.cs
- WebReferencesBuildProvider.cs
- XmlUtf8RawTextWriter.cs
- ShimAsPublicXamlType.cs
- PageTrueTypeFont.cs
- CompositeControl.cs
- MultiByteCodec.cs
- LinkAreaEditor.cs
- PageContentCollection.cs
- Faults.cs
- XmlILAnnotation.cs
- UrlPath.cs
- WebPartUtil.cs
- RoleManagerEventArgs.cs
- CallbackDebugBehavior.cs
- FormatterServicesNoSerializableCheck.cs
- iisPickupDirectory.cs
- XomlSerializationHelpers.cs
- MultiSelector.cs
- BamlVersionHeader.cs
- WebPartPersonalization.cs
- MemberInfoSerializationHolder.cs
- NetStream.cs
- SqlRetyper.cs
- XPathScanner.cs
- FactoryGenerator.cs
- Decorator.cs
- VirtualPath.cs