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
- ValidatorCollection.cs
- ReachNamespaceInfo.cs
- ExceptionHandlerDesigner.cs
- Utils.cs
- Point.cs
- ToolBar.cs
- XamlDebuggerXmlReader.cs
- DeviceContexts.cs
- CharStorage.cs
- SecurityContext.cs
- SafeFileMappingHandle.cs
- ExpressionBindingCollection.cs
- ValueSerializer.cs
- HelpOperationInvoker.cs
- ZipIOLocalFileBlock.cs
- ExceptionNotification.cs
- OrderedDictionaryStateHelper.cs
- MailWriter.cs
- dataSvcMapFileLoader.cs
- FlowLayoutSettings.cs
- StatusBar.cs
- ListItemCollection.cs
- HttpModuleAction.cs
- Ref.cs
- ExpressionBindings.cs
- PrePostDescendentsWalker.cs
- FileLevelControlBuilderAttribute.cs
- IndexerNameAttribute.cs
- PasswordTextContainer.cs
- TimeSpanMinutesConverter.cs
- TextTreeUndo.cs
- StringInfo.cs
- CookieProtection.cs
- PageCodeDomTreeGenerator.cs
- PixelFormat.cs
- SpotLight.cs
- CopyAttributesAction.cs
- CacheAxisQuery.cs
- TextHidden.cs
- TemplateLookupAction.cs
- TrackingDataItem.cs
- CapiHashAlgorithm.cs
- PeerNameResolver.cs
- Bits.cs
- TemplateContentLoader.cs
- UpWmlMobileTextWriter.cs
- GridViewCommandEventArgs.cs
- TcpHostedTransportConfiguration.cs
- XmlSchema.cs
- StatusBarAutomationPeer.cs
- Column.cs
- SByteStorage.cs
- FaultReasonText.cs
- XmlSchemaGroupRef.cs
- mansign.cs
- EditorPartCollection.cs
- SchemaTypeEmitter.cs
- TextRangeBase.cs
- IisTraceListener.cs
- ThicknessAnimationUsingKeyFrames.cs
- XNameTypeConverter.cs
- SqlUserDefinedTypeAttribute.cs
- KeySplineConverter.cs
- WebEncodingValidatorAttribute.cs
- BufferedStream.cs
- ReadOnlyDataSource.cs
- EntityAdapter.cs
- DeclarativeCatalogPartDesigner.cs
- SystemIPv6InterfaceProperties.cs
- DesignTable.cs
- BindingBase.cs
- CorrelationActionMessageFilter.cs
- Interop.cs
- SqlClientWrapperSmiStream.cs
- Application.cs
- RootProjectionNode.cs
- HiddenFieldPageStatePersister.cs
- SettingsProviderCollection.cs
- TransformCollection.cs
- XPathBuilder.cs
- VirtualizingPanel.cs
- VSWCFServiceContractGenerator.cs
- SafeSecurityHelper.cs
- StateWorkerRequest.cs
- OdbcInfoMessageEvent.cs
- ModuleElement.cs
- TextEndOfLine.cs
- CheckBoxFlatAdapter.cs
- Int16Converter.cs
- HitTestParameters3D.cs
- ContainerControl.cs
- HtmlWindow.cs
- DataViewListener.cs
- CopyNamespacesAction.cs
- SqlConnectionManager.cs
- DataProviderNameConverter.cs
- SocketElement.cs
- GZipStream.cs
- PersonalizationProvider.cs
- BindingExpressionUncommonField.cs