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 / Map / ViewGeneration / CqlGeneration / CqlWriter.cs / 1 / 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
- EventlogProvider.cs
- lengthconverter.cs
- TemplatePropertyEntry.cs
- Vertex.cs
- PartialTrustVisibleAssemblyCollection.cs
- GroupByExpressionRewriter.cs
- CompilerTypeWithParams.cs
- XPathAncestorIterator.cs
- DataGridViewBindingCompleteEventArgs.cs
- DesignerPerfEventProvider.cs
- MissingManifestResourceException.cs
- ReversePositionQuery.cs
- Exceptions.cs
- ExpandedWrapper.cs
- RelatedImageListAttribute.cs
- GridView.cs
- LoginUtil.cs
- DataGridViewIntLinkedList.cs
- StringBuilder.cs
- CompilerParameters.cs
- Header.cs
- NullRuntimeConfig.cs
- SessionIDManager.cs
- XmlDataSourceDesigner.cs
- CodeNamespaceImport.cs
- PropertyEmitter.cs
- IISUnsafeMethods.cs
- ResponseBodyWriter.cs
- LookupBindingPropertiesAttribute.cs
- X509Certificate.cs
- StackOverflowException.cs
- CompatibleIComparer.cs
- TypedDataSourceCodeGenerator.cs
- sitestring.cs
- StylusOverProperty.cs
- ErrorRuntimeConfig.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- LeafCellTreeNode.cs
- XmlComplianceUtil.cs
- HotSpotCollection.cs
- XmlUTF8TextReader.cs
- DataGridColumnReorderingEventArgs.cs
- DATA_BLOB.cs
- ObsoleteAttribute.cs
- LinkUtilities.cs
- WebResponse.cs
- XmlObjectSerializerWriteContextComplex.cs
- SelectingProviderEventArgs.cs
- DataBinding.cs
- DesignerProperties.cs
- GetPageCompletedEventArgs.cs
- ButtonBase.cs
- ProcessHostFactoryHelper.cs
- DBCommandBuilder.cs
- JapaneseLunisolarCalendar.cs
- Schema.cs
- ChooseAction.cs
- CustomServiceCredentials.cs
- QueryContext.cs
- InternalControlCollection.cs
- SecurityContext.cs
- Calendar.cs
- ValidationRuleCollection.cs
- SafeSerializationManager.cs
- UserPersonalizationStateInfo.cs
- KeyGesture.cs
- DataGridTextBox.cs
- EasingQuaternionKeyFrame.cs
- ButtonBase.cs
- EntityContainer.cs
- MSHTMLHost.cs
- Bezier.cs
- GeometryModel3D.cs
- XmlElementCollection.cs
- ExistsInCollection.cs
- TreeBuilder.cs
- TableLayoutPanelBehavior.cs
- TypeUsage.cs
- AsymmetricSignatureFormatter.cs
- Int32CollectionConverter.cs
- DotExpr.cs
- MarkupExtensionParser.cs
- CommandDevice.cs
- Walker.cs
- PackageDigitalSignature.cs
- ChannelSinkStacks.cs
- OpenFileDialog.cs
- AutomationPattern.cs
- HandledMouseEvent.cs
- FormViewDeletedEventArgs.cs
- _NetRes.cs
- LogWriteRestartAreaState.cs
- ExtenderProvidedPropertyAttribute.cs
- RecordManager.cs
- WinFormsSpinner.cs
- WmlControlAdapter.cs
- ImportRequest.cs
- ListViewDataItem.cs
- DataGridViewDataErrorEventArgs.cs
- TextContainerChangeEventArgs.cs