Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / CqlGeneration / CqlWriter.cs / 2 / 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 internal static void AppendEscapedTypeName(StringBuilder builder, EdmType type) { AppendEscapedQualifiedName(builder, type.NamespaceName, type.Name); } // effects: Modifies builder to contain an escaped version of "namespc.name" internal static void AppendEscapedQualifiedName(StringBuilder builder, string namespc, string name) { AppendEscapedName(builder, namespc); builder.Append('.'); AppendEscapedName(builder, name); } // 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. //---------------------------------------------------------------------- //// 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 internal static void AppendEscapedTypeName(StringBuilder builder, EdmType type) { AppendEscapedQualifiedName(builder, type.NamespaceName, type.Name); } // effects: Modifies builder to contain an escaped version of "namespc.name" internal static void AppendEscapedQualifiedName(StringBuilder builder, string namespc, string name) { AppendEscapedName(builder, namespc); builder.Append('.'); AppendEscapedName(builder, name); } // 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
- ObjectQueryProvider.cs
- GeometryModel3D.cs
- EntityReference.cs
- SqlBulkCopyColumnMappingCollection.cs
- CompilationSection.cs
- MSAAEventDispatcher.cs
- FontNamesConverter.cs
- DataGridCellAutomationPeer.cs
- QueryParameter.cs
- XamlPointCollectionSerializer.cs
- TypefaceMap.cs
- XmlSchema.cs
- MouseOverProperty.cs
- SiteMapNodeCollection.cs
- XamlReader.cs
- BaseCAMarshaler.cs
- FileDialog_Vista_Interop.cs
- CurrentChangingEventManager.cs
- BinaryUtilClasses.cs
- DataGridViewCellConverter.cs
- LinqToSqlWrapper.cs
- ActivityXRefPropertyEditor.cs
- ToolZone.cs
- ComPlusAuthorization.cs
- CryptoSession.cs
- HebrewCalendar.cs
- CodeTryCatchFinallyStatement.cs
- PromptStyle.cs
- StyleTypedPropertyAttribute.cs
- TaiwanCalendar.cs
- FillBehavior.cs
- Int32Animation.cs
- TargetConverter.cs
- ConfigurationLocation.cs
- XmlEncodedRawTextWriter.cs
- AttributeInfo.cs
- RestHandlerFactory.cs
- MiniCustomAttributeInfo.cs
- QuaternionRotation3D.cs
- SvcMapFileSerializer.cs
- ValidationHelper.cs
- PerformanceCounterPermissionEntryCollection.cs
- FormsAuthenticationTicket.cs
- CfgParser.cs
- FixUpCollection.cs
- hresults.cs
- CheckBoxRenderer.cs
- VectorKeyFrameCollection.cs
- EditorResources.cs
- ReadWriteObjectLock.cs
- SystemFonts.cs
- DataGridViewTopLeftHeaderCell.cs
- Rules.cs
- HttpCapabilitiesSectionHandler.cs
- CodeGeneratorAttribute.cs
- DesignerContextDescriptor.cs
- ListViewPagedDataSource.cs
- SupportsEventValidationAttribute.cs
- ProtectedProviderSettings.cs
- HebrewNumber.cs
- AnimationClock.cs
- TCEAdapterGenerator.cs
- XmlSchemaAttributeGroup.cs
- CategoryValueConverter.cs
- CharUnicodeInfo.cs
- RuntimeArgumentHandle.cs
- URI.cs
- DeviceContexts.cs
- ServiceSecurityAuditElement.cs
- TagMapInfo.cs
- ConfigurationPropertyCollection.cs
- ValueTable.cs
- ProjectionPath.cs
- TableCell.cs
- Encoder.cs
- SamlAttribute.cs
- StylusPointCollection.cs
- DbBuffer.cs
- XamlTypeMapper.cs
- StringDictionary.cs
- ShortcutKeysEditor.cs
- StretchValidation.cs
- SqlCharStream.cs
- Function.cs
- SQLConvert.cs
- CompiledQueryCacheKey.cs
- LocalizedNameDescriptionPair.cs
- PolyQuadraticBezierSegment.cs
- InfocardChannelParameter.cs
- VersionedStream.cs
- ListBox.cs
- QueryCacheManager.cs
- DtrList.cs
- MimeMultiPart.cs
- XmlTextReaderImplHelpers.cs
- VisualStyleTypesAndProperties.cs
- FixedSOMTableCell.cs
- XmlWriter.cs
- Vector3DConverter.cs
- Single.cs