Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / CqlGeneration / CqlWriter.cs / 1305376 / CqlWriter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Text.RegularExpressions; using System.Text; using System.Data.Common.Utils; using System.Data.Mapping.ViewGeneration.Utils; using System.Data.Metadata.Edm; namespace System.Data.Mapping.ViewGeneration.CqlGeneration { // This class contains helper methods needed for generating Cql internal static class CqlWriter { #region Fields private static readonly Regex s_wordIdentifierRegex = new Regex(@"^[_A-Za-z]\w*$", RegexOptions.ECMAScript | RegexOptions.Compiled); #endregion #region Helper Methods // effects: Given a block name and a field in it -- returns a string // of form "blockName.field". Does not perform any escaping internal static string GetQualifiedName(string blockName, string field) { string result = StringUtil.FormatInvariant("{0}.{1}", blockName, field); return result; } // effects: Modifies builder to contain an escaped version of type's name as "[namespace.typename]" internal static void AppendEscapedTypeName(StringBuilder builder, EdmType type) { AppendEscapedName(builder, GetQualifiedName(type.NamespaceName, type.Name)); } // effects: Modifies builder to contain an escaped version of "name1.name2" as "[name1].[name2]" internal static void AppendEscapedQualifiedName(StringBuilder builder, string name1, string name2) { AppendEscapedName(builder, name1); builder.Append('.'); AppendEscapedName(builder, name2); } // effects: Modifies builder to contain an escaped version of "name" internal static void AppendEscapedName(StringBuilder builder, string name) { if (s_wordIdentifierRegex.IsMatch(name) && false == ExternalCalls.IsReservedKeyword(name)) { // We do not need to escape the name if it is a simple name and it is not a keyword builder.Append(name); } else { string newName = name.Replace("]", "]]"); builder.Append('[') .Append(newName) .Append(']'); } } #endregion } } // 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
- SBCSCodePageEncoding.cs
- RoutedUICommand.cs
- MonitorWrapper.cs
- ServiceOperationInfoTypeConverter.cs
- SectionRecord.cs
- DbProviderFactory.cs
- TemplateControl.cs
- XsdCachingReader.cs
- ExpressionBuilderCollection.cs
- TrackingMemoryStreamFactory.cs
- MobileControlsSectionHandler.cs
- AuthStoreRoleProvider.cs
- ConfigurationPropertyCollection.cs
- BufferedResponseStream.cs
- BitArray.cs
- UserControl.cs
- DocumentApplication.cs
- XmlCharacterData.cs
- X509Utils.cs
- Pipe.cs
- DateTimeOffset.cs
- FixedHyperLink.cs
- MatrixUtil.cs
- SharedUtils.cs
- XmlILIndex.cs
- TransactionException.cs
- DiscardableAttribute.cs
- Inflater.cs
- TextFragmentEngine.cs
- AssemblyInfo.cs
- ProgressBarRenderer.cs
- Expressions.cs
- CustomError.cs
- TryLoadRunnableWorkflowCommand.cs
- DateTimeOffsetConverter.cs
- Accessors.cs
- WebConfigurationFileMap.cs
- DataColumnMapping.cs
- ToolTipAutomationPeer.cs
- ToolStripTextBox.cs
- EventLogStatus.cs
- InputLanguageProfileNotifySink.cs
- GradientBrush.cs
- WorkflowInstanceRecord.cs
- TableHeaderCell.cs
- HtmlString.cs
- DiscoveryServerProtocol.cs
- ListBase.cs
- Bits.cs
- VariableQuery.cs
- LocalizedNameDescriptionPair.cs
- JsonReaderDelegator.cs
- GeometryCombineModeValidation.cs
- EventLog.cs
- WebBrowserBase.cs
- UnknownWrapper.cs
- IndexerNameAttribute.cs
- StrokeNodeEnumerator.cs
- EncoderParameters.cs
- StaticFileHandler.cs
- CalendarTable.cs
- TerminatorSinks.cs
- DirectoryObjectSecurity.cs
- WebHttpElement.cs
- LineGeometry.cs
- EventRoute.cs
- SamlSubject.cs
- PropertyMetadata.cs
- HostedElements.cs
- ErrorHandler.cs
- ConfigXmlSignificantWhitespace.cs
- IntMinMaxAggregationOperator.cs
- GraphicsContext.cs
- CurrencyManager.cs
- ValidatorCollection.cs
- ImageAttributes.cs
- M3DUtil.cs
- QuaternionAnimation.cs
- DateTimeStorage.cs
- ProcessHost.cs
- X509CertificateValidator.cs
- ScriptComponentDescriptor.cs
- TouchPoint.cs
- WSHttpBindingCollectionElement.cs
- EntryIndex.cs
- OSFeature.cs
- BufferAllocator.cs
- PageRequestManager.cs
- sortedlist.cs
- StringUtil.cs
- ConfigXmlElement.cs
- GenericEnumerator.cs
- MonthChangedEventArgs.cs
- DoubleCollectionValueSerializer.cs
- XmlDocumentFragment.cs
- WindowsIdentity.cs
- ErrorStyle.cs
- EmbossBitmapEffect.cs
- SettingsContext.cs
- FormsAuthenticationUser.cs