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
- ProcessHostServerConfig.cs
- CursorConverter.cs
- MonitorWrapper.cs
- BrowserDefinitionCollection.cs
- File.cs
- RegexCharClass.cs
- DropShadowEffect.cs
- BitmapEffectState.cs
- DirectionalLight.cs
- StreamProxy.cs
- MemberAccessException.cs
- WebPartManagerInternals.cs
- MarkupCompilePass2.cs
- ContainerActivationHelper.cs
- COM2EnumConverter.cs
- FigureParagraph.cs
- VirtualizingPanel.cs
- SafeLocalMemHandle.cs
- RightsManagementInformation.cs
- WasEndpointConfigContainer.cs
- ApplicationContext.cs
- _Events.cs
- WinFormsSpinner.cs
- StrokeNodeOperations.cs
- ClientReliableChannelBinder.cs
- FormsIdentity.cs
- CatalogPartCollection.cs
- Deserializer.cs
- FolderBrowserDialog.cs
- HttpRawResponse.cs
- EventBuilder.cs
- PersonalizationState.cs
- Single.cs
- SecurityKeyType.cs
- StyleReferenceConverter.cs
- SchemaLookupTable.cs
- PingOptions.cs
- WebPartZoneAutoFormat.cs
- Int64.cs
- CreateUserErrorEventArgs.cs
- DataSourceNameHandler.cs
- DBCSCodePageEncoding.cs
- CompatibleComparer.cs
- EntityConnection.cs
- ReadOnlyCollectionBase.cs
- InfoCardListRequest.cs
- DatasetMethodGenerator.cs
- DataGridCheckBoxColumn.cs
- SendMessageContent.cs
- uribuilder.cs
- Rules.cs
- MulticastNotSupportedException.cs
- Transaction.cs
- SignedXml.cs
- BindingFormattingDialog.cs
- CardSpaceSelector.cs
- sqlinternaltransaction.cs
- SafeNativeMethods.cs
- CodeIdentifiers.cs
- PopOutPanel.cs
- ListBindingHelper.cs
- DebugView.cs
- ThemeableAttribute.cs
- AbsoluteQuery.cs
- SmtpDigestAuthenticationModule.cs
- MetadataPropertyvalue.cs
- CharConverter.cs
- FreezableDefaultValueFactory.cs
- TabRenderer.cs
- CultureMapper.cs
- StreamInfo.cs
- SQLDouble.cs
- NativeMsmqMessage.cs
- CompilerCollection.cs
- ValueUtilsSmi.cs
- XmlElementList.cs
- CodeCatchClauseCollection.cs
- Console.cs
- PixelFormat.cs
- ImportStoreException.cs
- IncomingWebRequestContext.cs
- StrokeSerializer.cs
- ComponentCollection.cs
- ChooseAction.cs
- SrgsDocument.cs
- CompModSwitches.cs
- MethodExpr.cs
- TableRow.cs
- SqlBulkCopyColumnMapping.cs
- EntityDataSourceEntitySetNameItem.cs
- UserNamePasswordValidator.cs
- EventSetterHandlerConverter.cs
- DoubleAnimationClockResource.cs
- PropertyTabChangedEvent.cs
- HostSecurityManager.cs
- OdbcConnection.cs
- TextRange.cs
- RMEnrollmentPage2.cs
- RemotingServices.cs
- ScriptingSectionGroup.cs