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
- LexicalChunk.cs
- CreateUserWizardStep.cs
- DataGridView.cs
- ViewGenerator.cs
- PermissionAttributes.cs
- ModelTreeEnumerator.cs
- CompiledRegexRunner.cs
- ChangeInterceptorAttribute.cs
- StreamingContext.cs
- WorkflowDesigner.cs
- Content.cs
- RangeValuePattern.cs
- PropertyManager.cs
- ColumnWidthChangedEvent.cs
- EventHandlersStore.cs
- KeyedHashAlgorithm.cs
- DataSourceSelectArguments.cs
- ButtonFieldBase.cs
- JsonServiceDocumentSerializer.cs
- RowParagraph.cs
- XmlWellformedWriter.cs
- sqlnorm.cs
- DataControlLinkButton.cs
- PanelStyle.cs
- ActivityInterfaces.cs
- WebPartConnectionsConfigureVerb.cs
- ProxyWebPartManagerDesigner.cs
- BrowserDefinition.cs
- RadioButtonPopupAdapter.cs
- CollectionConverter.cs
- NumberSubstitution.cs
- QueryExpression.cs
- DelegateBodyWriter.cs
- TableItemStyle.cs
- BitmapEffectGeneralTransform.cs
- WindowsAuthenticationEventArgs.cs
- UdpSocketReceiveManager.cs
- WsatServiceAddress.cs
- Camera.cs
- XamlDesignerSerializationManager.cs
- ThemeDirectoryCompiler.cs
- BulletedListEventArgs.cs
- SiteMap.cs
- DashStyle.cs
- RegexBoyerMoore.cs
- AssemblyCache.cs
- ToolStripManager.cs
- ConfigurationPropertyAttribute.cs
- UserUseLicenseDictionaryLoader.cs
- UInt32Converter.cs
- ProcessModelInfo.cs
- ExtractedStateEntry.cs
- ValueTypeFixupInfo.cs
- DateTimeOffsetStorage.cs
- SQLGuid.cs
- InternalPermissions.cs
- VirtualPathUtility.cs
- SingleSelectRootGridEntry.cs
- DispatcherExceptionFilterEventArgs.cs
- TextFormatterHost.cs
- StoreItemCollection.Loader.cs
- XmlTextWriter.cs
- WebPartConnectionsCancelVerb.cs
- CompilerScope.Storage.cs
- HashHelper.cs
- SelectionRange.cs
- Utils.cs
- Boolean.cs
- Int32RectValueSerializer.cs
- GB18030Encoding.cs
- ServiceModelConfigurationSectionGroup.cs
- XmlTypeMapping.cs
- DataError.cs
- OracleConnectionStringBuilder.cs
- ObjectReaderCompiler.cs
- ColorComboBox.cs
- UserThread.cs
- QueryCacheEntry.cs
- EntitySqlQueryBuilder.cs
- KeyValueConfigurationElement.cs
- XmlSchemaAttributeGroup.cs
- PageParser.cs
- ModelPerspective.cs
- MessageContractMemberAttribute.cs
- FormViewDeletedEventArgs.cs
- Unit.cs
- ParsedAttributeCollection.cs
- HttpTransportSecurityElement.cs
- TranslateTransform.cs
- WindowsListViewSubItem.cs
- SessionState.cs
- SingleAnimationUsingKeyFrames.cs
- UInt32Converter.cs
- _UriTypeConverter.cs
- ServiceHostingEnvironment.cs
- DbConnectionHelper.cs
- ResourceContainer.cs
- NotifyCollectionChangedEventArgs.cs
- DeferredSelectedIndexReference.cs
- SqlDataSourceEnumerator.cs