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
- InsufficientMemoryException.cs
- __ComObject.cs
- ControlAdapter.cs
- DataGridTable.cs
- ParagraphVisual.cs
- PolyQuadraticBezierSegment.cs
- DbProviderFactory.cs
- DataRowCollection.cs
- EntityClientCacheEntry.cs
- SqlCacheDependencyDatabaseCollection.cs
- AppModelKnownContentFactory.cs
- QueryComponents.cs
- DataObject.cs
- SymbolEqualComparer.cs
- DataGridViewLinkCell.cs
- StandardCommandToolStripMenuItem.cs
- InvalidPipelineStoreException.cs
- WebPartEventArgs.cs
- PersistenceTypeAttribute.cs
- PieceDirectory.cs
- SiteMembershipCondition.cs
- smtpconnection.cs
- TempFiles.cs
- StackOverflowException.cs
- BasicCellRelation.cs
- RefreshPropertiesAttribute.cs
- RTTypeWrapper.cs
- StretchValidation.cs
- OrthographicCamera.cs
- BaseUriHelper.cs
- MeshGeometry3D.cs
- TypedTableBaseExtensions.cs
- Avt.cs
- DtdParser.cs
- MetabaseSettingsIis7.cs
- TrustManager.cs
- X509Utils.cs
- SyndicationFeedFormatter.cs
- SafeArrayRankMismatchException.cs
- OpenFileDialog.cs
- ImageSource.cs
- ImmComposition.cs
- LogSwitch.cs
- HitTestFilterBehavior.cs
- DragDeltaEventArgs.cs
- Window.cs
- WindowPatternIdentifiers.cs
- BeginEvent.cs
- FrameworkRichTextComposition.cs
- TextTreeObjectNode.cs
- SEHException.cs
- CompareInfo.cs
- Cursors.cs
- DataList.cs
- ResourceKey.cs
- ListViewHitTestInfo.cs
- _Semaphore.cs
- LinkArea.cs
- WebHeaderCollection.cs
- CacheSection.cs
- SqlCacheDependencyDatabase.cs
- HttpHandlerAction.cs
- ImageCollectionEditor.cs
- Table.cs
- GeneralTransform.cs
- ProcessManager.cs
- FixedSOMTable.cs
- HideDisabledControlAdapter.cs
- CompiledRegexRunner.cs
- LoadedEvent.cs
- SingleAnimationBase.cs
- BasicAsyncResult.cs
- GB18030Encoding.cs
- IgnoreFileBuildProvider.cs
- HttpSysSettings.cs
- ExpressionVisitor.cs
- EdmMember.cs
- StringHandle.cs
- HMACSHA1.cs
- TemplateKey.cs
- DefaultDiscoveryServiceExtension.cs
- TypeUnloadedException.cs
- HostingEnvironment.cs
- ObjectListGeneralPage.cs
- BinaryUtilClasses.cs
- XMLSyntaxException.cs
- InheritedPropertyChangedEventArgs.cs
- ValidatedControlConverter.cs
- DefaultAssemblyResolver.cs
- ExtenderProvidedPropertyAttribute.cs
- StreamSecurityUpgradeAcceptor.cs
- SqlServices.cs
- EntityDataSourceContainerNameItem.cs
- ThrowHelper.cs
- SHA512Managed.cs
- OverloadGroupAttribute.cs
- CodeObject.cs
- QilLoop.cs
- BaseTreeIterator.cs
- ServiceObjectContainer.cs