Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / SqlWriter.cs / 1 / 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
- Vector3DAnimationUsingKeyFrames.cs
- XPathItem.cs
- TdsParserStateObject.cs
- PropertyToken.cs
- EventDriven.cs
- BadImageFormatException.cs
- CatalogPart.cs
- TrustLevelCollection.cs
- HelpKeywordAttribute.cs
- DBConnectionString.cs
- GeneralTransform3DGroup.cs
- MultiTrigger.cs
- RegexMatch.cs
- ToolTipService.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- PaginationProgressEventArgs.cs
- RequiredAttributeAttribute.cs
- SolidColorBrush.cs
- InternalTypeHelper.cs
- ResourcesGenerator.cs
- ReadOnlyNameValueCollection.cs
- EncodedStreamFactory.cs
- Parser.cs
- EncodingStreamWrapper.cs
- DataGridViewCell.cs
- DbExpressionRules.cs
- _BasicClient.cs
- ListControlBuilder.cs
- TraceData.cs
- XmlSchemaAttribute.cs
- AdapterDictionary.cs
- BinaryFormatter.cs
- XMLUtil.cs
- ForceCopyBuildProvider.cs
- DocumentPageTextView.cs
- GeometryValueSerializer.cs
- BaseDataBoundControl.cs
- StartUpEventArgs.cs
- IntegerValidator.cs
- NavigationWindow.cs
- UnsafeNativeMethods.cs
- FatalException.cs
- ComplexObject.cs
- AggregateNode.cs
- DecimalStorage.cs
- QueryRewriter.cs
- TextContainerHelper.cs
- DBConnectionString.cs
- ByteStorage.cs
- BrowserCapabilitiesCompiler.cs
- ModelPerspective.cs
- DataGridItemEventArgs.cs
- AnimatedTypeHelpers.cs
- DispatcherObject.cs
- StylusPointProperty.cs
- Vector3D.cs
- util.cs
- ParagraphVisual.cs
- WCFModelStrings.Designer.cs
- DynamicControlParameter.cs
- ScriptHandlerFactory.cs
- CodeGenerationManager.cs
- DbConvert.cs
- MetadataPropertyAttribute.cs
- SortDescriptionCollection.cs
- OleDbCommand.cs
- SmtpNetworkElement.cs
- DataGridViewLayoutData.cs
- ChameleonKey.cs
- RepeatInfo.cs
- RuleRefElement.cs
- Positioning.cs
- EpmTargetPathSegment.cs
- OdbcConnectionString.cs
- OpenTypeLayout.cs
- DoubleSumAggregationOperator.cs
- ArcSegment.cs
- SHA384.cs
- OracleCommandBuilder.cs
- MetadataFile.cs
- AttributeQuery.cs
- XmlObjectSerializerWriteContextComplex.cs
- DetailsViewUpdateEventArgs.cs
- ExpandSegment.cs
- PlanCompiler.cs
- AspCompat.cs
- RotationValidation.cs
- Track.cs
- BindingExpressionBase.cs
- SpotLight.cs
- ProfessionalColorTable.cs
- DataGridAutoFormatDialog.cs
- WorkflowViewService.cs
- AccessedThroughPropertyAttribute.cs
- ConfigsHelper.cs
- ModelItemCollectionImpl.cs
- SRGSCompiler.cs
- Knowncolors.cs
- PropertyGridDesigner.cs
- ProxyWebPartManager.cs