Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- CollectionEditor.cs
- OLEDB_Util.cs
- Socket.cs
- QilList.cs
- _PooledStream.cs
- RegexCompiler.cs
- EventItfInfo.cs
- CodeAccessPermission.cs
- XmlDataCollection.cs
- ChannelBuilder.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- XPathParser.cs
- WinEventWrap.cs
- DbMetaDataCollectionNames.cs
- securitymgrsite.cs
- _SSPIWrapper.cs
- _KerberosClient.cs
- HyperLink.cs
- QilNode.cs
- DBCommand.cs
- ComponentChangingEvent.cs
- ApplicationSettingsBase.cs
- ToolZone.cs
- OdbcEnvironmentHandle.cs
- EntityDataSourceStatementEditorForm.cs
- NonClientArea.cs
- SettingsAttributes.cs
- GestureRecognizer.cs
- IgnoreFileBuildProvider.cs
- DataColumnSelectionConverter.cs
- Function.cs
- CallbackValidatorAttribute.cs
- EntityDataSourceDesigner.cs
- PeerService.cs
- DesignerActionGlyph.cs
- DetailsViewPagerRow.cs
- WorkerRequest.cs
- MarkupObject.cs
- InfiniteTimeSpanConverter.cs
- XLinq.cs
- SubstitutionList.cs
- GlyphTypeface.cs
- NullableFloatMinMaxAggregationOperator.cs
- SamlAssertionKeyIdentifierClause.cs
- Visual3D.cs
- SamlSecurityToken.cs
- QilTypeChecker.cs
- ClientConvert.cs
- DataTableExtensions.cs
- StrokeFIndices.cs
- ClientSettingsProvider.cs
- LinqDataSourceUpdateEventArgs.cs
- XmlSchemaChoice.cs
- PackagePartCollection.cs
- VariableQuery.cs
- AttributeAction.cs
- EventSetter.cs
- SelectedGridItemChangedEvent.cs
- HelloMessage11.cs
- PathFigureCollection.cs
- TextLineBreak.cs
- FormsAuthenticationTicket.cs
- ColorMap.cs
- codemethodreferenceexpression.cs
- CookieParameter.cs
- RawKeyboardInputReport.cs
- ApplicationSecurityManager.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- ByteRangeDownloader.cs
- Grid.cs
- ConnectionProviderAttribute.cs
- EncodingInfo.cs
- ExeConfigurationFileMap.cs
- StructuredType.cs
- IsolatedStorageException.cs
- TextPenaltyModule.cs
- EllipseGeometry.cs
- HttpPostServerProtocol.cs
- EventDrivenDesigner.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- Journal.cs
- IdentitySection.cs
- AlphaSortedEnumConverter.cs
- DescendentsWalkerBase.cs
- Classification.cs
- ValidationSummary.cs
- ToolBarButtonClickEvent.cs
- ColumnWidthChangedEvent.cs
- ObjectDataSourceFilteringEventArgs.cs
- TableLayoutStyle.cs
- BuildProviderAppliesToAttribute.cs
- AuthorizationRule.cs
- Pair.cs
- InkPresenter.cs
- SqlTypeConverter.cs
- ObjectDataSourceFilteringEventArgs.cs
- mongolianshape.cs
- BamlLocalizabilityResolver.cs
- EntityDataSourceChangedEventArgs.cs
- updateconfighost.cs