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
- XmlAtomicValue.cs
- DeploymentSectionCache.cs
- BoundColumn.cs
- TimeSpan.cs
- StrokeFIndices.cs
- ParenthesizePropertyNameAttribute.cs
- PersonalizablePropertyEntry.cs
- DiagnosticTrace.cs
- RecommendedAsConfigurableAttribute.cs
- Grant.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- KeyboardDevice.cs
- InvokeSchedule.cs
- ObjectAnimationBase.cs
- X509CertificateEndpointIdentity.cs
- NodeFunctions.cs
- ParallelEnumerableWrapper.cs
- EntityDesignerDataSourceView.cs
- SafeCryptoHandles.cs
- HttpHandlerAction.cs
- XmlSchemaInferenceException.cs
- DefaultTextStore.cs
- ExpressionPrinter.cs
- NewArrayExpression.cs
- UnionCqlBlock.cs
- PolygonHotSpot.cs
- ProfileProvider.cs
- DateTimeSerializationSection.cs
- NetworkCredential.cs
- DataServiceBehavior.cs
- KeyedHashAlgorithm.cs
- SmiEventSink_Default.cs
- SystemSounds.cs
- SafeMILHandle.cs
- Identity.cs
- AppDomainUnloadedException.cs
- ZipIOExtraFieldZip64Element.cs
- XmlCodeExporter.cs
- ToolStripGrip.cs
- EdmPropertyAttribute.cs
- TextElementCollectionHelper.cs
- AmbientLight.cs
- SimpleType.cs
- MouseWheelEventArgs.cs
- InternalsVisibleToAttribute.cs
- IgnoreFileBuildProvider.cs
- StandardBindingElement.cs
- LoginUtil.cs
- UnsafeNetInfoNativeMethods.cs
- SafeNativeMethods.cs
- SqlCaseSimplifier.cs
- XamlTypeMapper.cs
- TextLine.cs
- DbSource.cs
- DataGridCell.cs
- DataTableMapping.cs
- PermissionSet.cs
- EastAsianLunisolarCalendar.cs
- ListViewSortEventArgs.cs
- RegexWorker.cs
- ElementMarkupObject.cs
- GeneralTransform3DTo2D.cs
- ObjectStateEntryDbDataRecord.cs
- TransactionOptions.cs
- CodeEntryPointMethod.cs
- HostVisual.cs
- EntityProviderFactory.cs
- JapaneseCalendar.cs
- MemoryRecordBuffer.cs
- DataGridRow.cs
- NoPersistScope.cs
- SolidBrush.cs
- DesignBindingConverter.cs
- HandlerFactoryCache.cs
- BinaryReader.cs
- MouseActionValueSerializer.cs
- UrlMappingCollection.cs
- ToolStripItemTextRenderEventArgs.cs
- ServerValidateEventArgs.cs
- CommandValueSerializer.cs
- MultiSelectRootGridEntry.cs
- AmbientValueAttribute.cs
- HijriCalendar.cs
- ADMembershipProvider.cs
- ScopeCollection.cs
- AdapterUtil.cs
- OdbcReferenceCollection.cs
- ListViewItemSelectionChangedEvent.cs
- SymLanguageVendor.cs
- basevalidator.cs
- ADConnectionHelper.cs
- ScriptingAuthenticationServiceSection.cs
- VirtualPathProvider.cs
- StylusShape.cs
- ProtocolsSection.cs
- ParserContext.cs
- SecurityTokenParametersEnumerable.cs
- LoginDesigner.cs
- RecognizeCompletedEventArgs.cs
- ConfigurationSectionGroupCollection.cs