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
- WorkItem.cs
- PackageDigitalSignature.cs
- ProcessInfo.cs
- IArgumentProvider.cs
- UserPreferenceChangedEventArgs.cs
- altserialization.cs
- SafeCryptoHandles.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- DynamicVirtualDiscoSearcher.cs
- SafeReversePInvokeHandle.cs
- DynamicILGenerator.cs
- BoundingRectTracker.cs
- BlockUIContainer.cs
- Soap.cs
- ExtensionFile.cs
- EmptyReadOnlyDictionaryInternal.cs
- CellTreeNodeVisitors.cs
- HwndHostAutomationPeer.cs
- MarkupWriter.cs
- ComponentChangingEvent.cs
- ContentElementAutomationPeer.cs
- VisualBrush.cs
- HttpFormatExtensions.cs
- DependencyPropertyDescriptor.cs
- AnnotationMap.cs
- WindowsStatusBar.cs
- HtmlCommandAdapter.cs
- SingleTagSectionHandler.cs
- prompt.cs
- UnicastIPAddressInformationCollection.cs
- OdbcInfoMessageEvent.cs
- SqlDeflator.cs
- WebPartsPersonalizationAuthorization.cs
- InputScopeConverter.cs
- PasswordRecoveryAutoFormat.cs
- DynamicRendererThreadManager.cs
- StateInitialization.cs
- Filter.cs
- ChannelServices.cs
- PartitionResolver.cs
- Viewport3DVisual.cs
- EventLogger.cs
- RegexNode.cs
- ResumeStoryboard.cs
- RangeValidator.cs
- Viewport2DVisual3D.cs
- PersonalizationStateInfoCollection.cs
- UIElement.cs
- RightsManagementEncryptionTransform.cs
- GACIdentityPermission.cs
- FormatterConverter.cs
- ClientSettingsProvider.cs
- TypeSystem.cs
- EdmRelationshipRoleAttribute.cs
- ToolStrip.cs
- IndexedGlyphRun.cs
- UpdateManifestForBrowserApplication.cs
- AutoResizedEvent.cs
- SynchronizedInputProviderWrapper.cs
- ConvertersCollection.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- LookupNode.cs
- EncryptedData.cs
- SiteOfOriginContainer.cs
- XmlSchemaExporter.cs
- DataPagerField.cs
- ColumnProvider.cs
- DesigntimeLicenseContextSerializer.cs
- HtmlInputText.cs
- TextBoxAutomationPeer.cs
- ThreadStartException.cs
- XmlElementAttributes.cs
- GCHandleCookieTable.cs
- SamlDoNotCacheCondition.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DialogResultConverter.cs
- RankException.cs
- ContentPosition.cs
- FixedSchema.cs
- DefaultBinder.cs
- HierarchicalDataSourceControl.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- WorkflowRuntimeServiceElementCollection.cs
- ConfigXmlDocument.cs
- DataList.cs
- FakeModelPropertyImpl.cs
- SqlBulkCopyColumnMapping.cs
- PageCatalogPart.cs
- OperatingSystem.cs
- PersonalizationStateInfo.cs
- SimpleBitVector32.cs
- MetadataPropertyAttribute.cs
- TableRow.cs
- SafeArrayTypeMismatchException.cs
- RecordManager.cs
- SqlCharStream.cs
- ObjectListShowCommandsEventArgs.cs
- Rotation3DKeyFrameCollection.cs
- ListViewItem.cs