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
- AttachedAnnotation.cs
- NamedPipeTransportSecurityElement.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- StickyNote.cs
- SrgsRuleRef.cs
- WindowsGraphics2.cs
- ToolBarPanel.cs
- PointUtil.cs
- XmlSchemaAnnotation.cs
- SamlDelegatingWriter.cs
- InvalidPrinterException.cs
- XmlValidatingReaderImpl.cs
- CmsInterop.cs
- UserNameSecurityToken.cs
- XmlObjectSerializerReadContext.cs
- Inflater.cs
- KnownBoxes.cs
- MyContact.cs
- IdentityReference.cs
- XmlWriterTraceListener.cs
- FreezableCollection.cs
- NativeMethods.cs
- FlowDocumentPaginator.cs
- InkCanvasFeedbackAdorner.cs
- DynamicExpression.cs
- SpecialNameAttribute.cs
- TemplatePropertyEntry.cs
- ColorPalette.cs
- WindowsFormsLinkLabel.cs
- Attribute.cs
- DataRecordInfo.cs
- NonBatchDirectoryCompiler.cs
- ChtmlImageAdapter.cs
- TransformerConfigurationWizardBase.cs
- ProcessModelInfo.cs
- GridViewColumn.cs
- RegistryConfigurationProvider.cs
- EventMappingSettingsCollection.cs
- OutOfMemoryException.cs
- ServiceObjectContainer.cs
- GridViewEditEventArgs.cs
- ContractHandle.cs
- ReferenceEqualityComparer.cs
- MergeFilterQuery.cs
- SecureStringHasher.cs
- SolidBrush.cs
- EmptyElement.cs
- ChangeTracker.cs
- InstanceDescriptor.cs
- FigureParaClient.cs
- ObjectContext.cs
- prompt.cs
- DES.cs
- ManifestResourceInfo.cs
- ForeignKeyConstraint.cs
- MediaCommands.cs
- ToolStripOverflow.cs
- Expressions.cs
- DesignerObjectListAdapter.cs
- DeadCharTextComposition.cs
- DPAPIProtectedConfigurationProvider.cs
- NetworkAddressChange.cs
- UnsafeNativeMethodsMilCoreApi.cs
- ResXDataNode.cs
- _TLSstream.cs
- LookupNode.cs
- XmlSchemaImporter.cs
- ModelTreeEnumerator.cs
- DataGridColumnReorderingEventArgs.cs
- PrintDialog.cs
- TdsParameterSetter.cs
- SessionEndedEventArgs.cs
- BasicKeyConstraint.cs
- DateTimePicker.cs
- DynamicField.cs
- SqlInternalConnectionTds.cs
- MatchSingleFxEngineOpcode.cs
- TextReader.cs
- MethodImplAttribute.cs
- CfgParser.cs
- ContainerParaClient.cs
- SynchronizationValidator.cs
- SoapHeaderAttribute.cs
- CompositionTarget.cs
- Fault.cs
- SiteMapNodeItem.cs
- DbInsertCommandTree.cs
- DockingAttribute.cs
- EffectiveValueEntry.cs
- Span.cs
- StylusCaptureWithinProperty.cs
- TheQuery.cs
- Transform3D.cs
- ObjectDataProvider.cs
- OletxDependentTransaction.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- ClientFormsIdentity.cs
- RangeValueProviderWrapper.cs
- ClientOptions.cs