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
- DispatcherExceptionEventArgs.cs
- HttpServerUtilityBase.cs
- ConvertTextFrag.cs
- codemethodreferenceexpression.cs
- TdsParserHelperClasses.cs
- SeekStoryboard.cs
- ForceCopyBuildProvider.cs
- URLMembershipCondition.cs
- TextCollapsingProperties.cs
- XmlSchemaAnnotation.cs
- ProjectionPlan.cs
- XmlCharCheckingReader.cs
- CheckBoxPopupAdapter.cs
- CodeCatchClauseCollection.cs
- SQLBinary.cs
- AnnouncementService.cs
- NameObjectCollectionBase.cs
- SamlAudienceRestrictionCondition.cs
- SqlConnectionPoolProviderInfo.cs
- WebScriptEnablingBehavior.cs
- NameSpaceExtractor.cs
- PlacementWorkspace.cs
- ReferenceList.cs
- SolidColorBrush.cs
- DriveInfo.cs
- ComplexType.cs
- CompoundFileStorageReference.cs
- TextMessageEncodingElement.cs
- DbSetClause.cs
- SessionParameter.cs
- CompilerScopeManager.cs
- WebPartHeaderCloseVerb.cs
- ClientScriptManager.cs
- GridToolTip.cs
- HtmlControlPersistable.cs
- PackageProperties.cs
- WebExceptionStatus.cs
- MetadataItem_Static.cs
- storepermissionattribute.cs
- ResourceDescriptionAttribute.cs
- sqlstateclientmanager.cs
- PlainXmlDeserializer.cs
- TextTreeExtractElementUndoUnit.cs
- SmiSettersStream.cs
- OleDbConnection.cs
- FormsAuthentication.cs
- ZoneButton.cs
- ToolStripMenuItemCodeDomSerializer.cs
- TransactionFlowElement.cs
- XmlDataImplementation.cs
- CheckBoxStandardAdapter.cs
- AnimatedTypeHelpers.cs
- ConvertTextFrag.cs
- BindingListCollectionView.cs
- MemberHolder.cs
- HttpResponse.cs
- ProcessStartInfo.cs
- WCFServiceClientProxyGenerator.cs
- StyleCollection.cs
- ElementInit.cs
- TwoPhaseCommit.cs
- DrawListViewItemEventArgs.cs
- AddInAttribute.cs
- XmlSchemaObjectCollection.cs
- ProfileManager.cs
- RecordManager.cs
- XmlValueConverter.cs
- HttpCacheParams.cs
- DataRowCollection.cs
- regiisutil.cs
- DesignerActionItemCollection.cs
- ApplicationSecurityManager.cs
- DecoderBestFitFallback.cs
- AdapterDictionary.cs
- ServerValidateEventArgs.cs
- ActivityInstanceMap.cs
- WhitespaceSignificantCollectionAttribute.cs
- RepeaterItemCollection.cs
- AsyncCompletedEventArgs.cs
- CategoryNameCollection.cs
- MetadataArtifactLoaderResource.cs
- XmlSchemaGroup.cs
- IsolationInterop.cs
- XmlSchemaSimpleTypeList.cs
- InputDevice.cs
- WebServiceTypeData.cs
- ExcludeFromCodeCoverageAttribute.cs
- ProviderConnectionPointCollection.cs
- ProjectionAnalyzer.cs
- AnnotationResourceChangedEventArgs.cs
- EventDrivenDesigner.cs
- Win32KeyboardDevice.cs
- PerformanceCounterManager.cs
- _AutoWebProxyScriptEngine.cs
- BuildResult.cs
- UrlMappingsSection.cs
- GraphicsContext.cs
- PageEventArgs.cs
- RunWorkerCompletedEventArgs.cs
- DataGridCellAutomationPeer.cs