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
- PageParserFilter.cs
- DataGridViewColumnCollection.cs
- RuntimeHelpers.cs
- CompilerError.cs
- XAMLParseException.cs
- FullTextLine.cs
- GridErrorDlg.cs
- EastAsianLunisolarCalendar.cs
- JapaneseLunisolarCalendar.cs
- HttpRawResponse.cs
- ObjectDataSourceSelectingEventArgs.cs
- Preprocessor.cs
- Point4DConverter.cs
- EdmValidator.cs
- StaticResourceExtension.cs
- StandardBindingElement.cs
- ToggleProviderWrapper.cs
- Cell.cs
- BufferModesCollection.cs
- WorkflowRuntimeSection.cs
- ByteStreamMessageEncoderFactory.cs
- UndirectedGraph.cs
- HttpRuntimeSection.cs
- Literal.cs
- Bidi.cs
- DataProtectionSecurityStateEncoder.cs
- StateRuntime.cs
- OdbcPermission.cs
- TextEncodedRawTextWriter.cs
- WriteableBitmap.cs
- TableParagraph.cs
- QilFunction.cs
- QilLoop.cs
- RawAppCommandInputReport.cs
- LicenseContext.cs
- OleDbParameterCollection.cs
- CheckBoxAutomationPeer.cs
- RealProxy.cs
- Predicate.cs
- AssemblyInfo.cs
- StickyNoteHelper.cs
- EntitySqlQueryCacheEntry.cs
- StylusPlugInCollection.cs
- EdmComplexTypeAttribute.cs
- XmlUtil.cs
- Grid.cs
- uribuilder.cs
- ComponentSerializationService.cs
- DataSourceListEditor.cs
- StandardCommands.cs
- RemotingServices.cs
- XmlSchemaValidator.cs
- RelatedView.cs
- ScriptManager.cs
- ExcludeFromCodeCoverageAttribute.cs
- MeshGeometry3D.cs
- XmlNodeList.cs
- Crypto.cs
- AppDomain.cs
- WpfWebRequestHelper.cs
- DataControlFieldHeaderCell.cs
- TextWriter.cs
- AutoSizeToolBoxItem.cs
- StickyNoteHelper.cs
- TypedRowHandler.cs
- XmlSchemaSimpleTypeRestriction.cs
- WebPartMinimizeVerb.cs
- SchemaImporter.cs
- SchemaElementDecl.cs
- DesignConnection.cs
- ObjectContextServiceProvider.cs
- GridViewPageEventArgs.cs
- UInt16Storage.cs
- FactoryGenerator.cs
- ActivityCodeDomReferenceService.cs
- CheckBoxRenderer.cs
- InternalRelationshipCollection.cs
- WorkflowView.cs
- CuspData.cs
- MenuStrip.cs
- XmlSchemaSubstitutionGroup.cs
- TemplateControlParser.cs
- ConfigXmlWhitespace.cs
- M3DUtil.cs
- ListControlDataBindingHandler.cs
- TraceShell.cs
- OperationPickerDialog.cs
- DeferredReference.cs
- SqlDataAdapter.cs
- OracleDataAdapter.cs
- MobileControlsSection.cs
- XmlSchemaType.cs
- RequestFactory.cs
- JsonFormatGeneratorStatics.cs
- TabletCollection.cs
- NegotiateStream.cs
- Cursor.cs
- DataRecord.cs
- NativeMethods.cs
- RegexParser.cs