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
- XmlUtil.cs
- DefaultAssemblyResolver.cs
- DateTimePicker.cs
- File.cs
- LabelLiteral.cs
- Rfc2898DeriveBytes.cs
- ObjectDataSourceChooseMethodsPanel.cs
- IdentityReference.cs
- FormatSettings.cs
- XmlException.cs
- JavaScriptSerializer.cs
- AssemblyAttributesGoHere.cs
- TreeBuilder.cs
- ExtensionWindowResizeGrip.cs
- XPathAncestorQuery.cs
- RemotingHelper.cs
- Calendar.cs
- Scheduling.cs
- ConfigurationConverterBase.cs
- PointHitTestParameters.cs
- HintTextMaxWidthConverter.cs
- ActivityDesignerResources.cs
- AdobeCFFWrapper.cs
- TemplateKeyConverter.cs
- ZipIOLocalFileDataDescriptor.cs
- IIS7ConfigurationLoader.cs
- DataObjectSettingDataEventArgs.cs
- VScrollBar.cs
- KeyedHashAlgorithm.cs
- GifBitmapEncoder.cs
- _LocalDataStore.cs
- WebFaultException.cs
- DBNull.cs
- XmlEnumAttribute.cs
- Size.cs
- HTTPNotFoundHandler.cs
- NativeMethods.cs
- ScriptRef.cs
- PathFigure.cs
- TemplateField.cs
- MenuItem.cs
- ToolStripGripRenderEventArgs.cs
- InternalRelationshipCollection.cs
- BitArray.cs
- DataGridViewSortCompareEventArgs.cs
- PageRanges.cs
- TreeNodeEventArgs.cs
- IteratorDescriptor.cs
- TextTreeRootNode.cs
- AspCompat.cs
- DataViewSetting.cs
- OutKeywords.cs
- RecommendedAsConfigurableAttribute.cs
- PopupControlService.cs
- NamedObject.cs
- SplineKeyFrames.cs
- CompiledQueryCacheKey.cs
- OleTxTransaction.cs
- X509Certificate2Collection.cs
- ToolStripAdornerWindowService.cs
- ContentHostHelper.cs
- XmlDownloadManager.cs
- DataGridViewCellConverter.cs
- XmlWriter.cs
- SapiRecoContext.cs
- TextDecorationCollectionConverter.cs
- XamlFigureLengthSerializer.cs
- _BaseOverlappedAsyncResult.cs
- EntityTypeEmitter.cs
- PageStatePersister.cs
- XslAst.cs
- WebPartCatalogAddVerb.cs
- Vector3DAnimationUsingKeyFrames.cs
- UnionQueryOperator.cs
- ProtectedConfigurationProviderCollection.cs
- BitmapEffectGroup.cs
- FixUp.cs
- InvokeBinder.cs
- DataView.cs
- NameValueSectionHandler.cs
- SHA512Managed.cs
- GridSplitter.cs
- RichTextBox.cs
- BamlTreeUpdater.cs
- LambdaCompiler.cs
- FamilyMap.cs
- CodeTypeReferenceExpression.cs
- NamedPipeChannelListener.cs
- SQLInt32.cs
- ImageClickEventArgs.cs
- ResourcesBuildProvider.cs
- XmlComplianceUtil.cs
- CategoryEditor.cs
- InvalidDataException.cs
- OdbcReferenceCollection.cs
- CryptoKeySecurity.cs
- DisplayToken.cs
- RenderDataDrawingContext.cs
- EdmSchemaError.cs
- DocumentPageHost.cs