Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- CannotUnloadAppDomainException.cs
- ProcessHostFactoryHelper.cs
- IISMapPath.cs
- WebPartAuthorizationEventArgs.cs
- JumpList.cs
- TextChangedEventArgs.cs
- OleDbTransaction.cs
- FamilyMap.cs
- XmlFormatExtensionPointAttribute.cs
- AsymmetricKeyExchangeFormatter.cs
- LocatorBase.cs
- FormViewModeEventArgs.cs
- PagedDataSource.cs
- StartFileNameEditor.cs
- InfiniteIntConverter.cs
- DateTimePicker.cs
- ToolStripItemCollection.cs
- ParseHttpDate.cs
- SplineKeyFrames.cs
- CookielessHelper.cs
- CodeGotoStatement.cs
- __Filters.cs
- QualifiedCellIdBoolean.cs
- ContentHostHelper.cs
- UIElement3D.cs
- ManipulationStartedEventArgs.cs
- GradientSpreadMethodValidation.cs
- IntegerCollectionEditor.cs
- StreamSecurityUpgradeAcceptor.cs
- DateTimeUtil.cs
- GraphicsContext.cs
- LinqExpressionNormalizer.cs
- ReferenceEqualityComparer.cs
- ValidatorCompatibilityHelper.cs
- FormattedText.cs
- RtfToXamlReader.cs
- HttpCacheVaryByContentEncodings.cs
- ListGeneralPage.cs
- TextEffectCollection.cs
- SignedXmlDebugLog.cs
- PrintPageEvent.cs
- TextEffectResolver.cs
- _ProxyChain.cs
- SoapCodeExporter.cs
- AttachedPropertyInfo.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- SystemIcons.cs
- ScriptingRoleServiceSection.cs
- TimeEnumHelper.cs
- Sequence.cs
- RandomDelaySendsAsyncResult.cs
- HelloMessageApril2005.cs
- AssemblyBuilderData.cs
- EmptyControlCollection.cs
- DependencyObjectProvider.cs
- ImageSourceConverter.cs
- SubMenuStyleCollection.cs
- CqlErrorHelper.cs
- DrawItemEvent.cs
- SpnegoTokenProvider.cs
- entityreference_tresulttype.cs
- XmlFormatExtensionPointAttribute.cs
- AutomationTextAttribute.cs
- ComplexType.cs
- precedingquery.cs
- ActivityInstanceMap.cs
- ICollection.cs
- bindurihelper.cs
- UInt16.cs
- UrlRoutingModule.cs
- ControlAdapter.cs
- SurrogateEncoder.cs
- ReadOnlyMetadataCollection.cs
- TextTreeInsertElementUndoUnit.cs
- ObjectDataSourceWizardForm.cs
- TextServicesLoader.cs
- ListViewItemMouseHoverEvent.cs
- DBConcurrencyException.cs
- HttpPostedFileBase.cs
- TransactionFormatter.cs
- PerfCounterSection.cs
- ApplicationProxyInternal.cs
- IisTraceWebEventProvider.cs
- _ProxyRegBlob.cs
- SrgsElement.cs
- ArgumentDesigner.xaml.cs
- ProxyElement.cs
- UniqueSet.cs
- TableSectionStyle.cs
- WebPartConnectionsConfigureVerb.cs
- TextTreeUndo.cs
- SafeRightsManagementQueryHandle.cs
- PreviewKeyDownEventArgs.cs
- ProfileModule.cs
- MembershipSection.cs
- EntityClassGenerator.cs
- ContainerParaClient.cs
- OleAutBinder.cs
- UIServiceHelper.cs
- GenericParameterDataContract.cs