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
- WorkflowQueue.cs
- Splitter.cs
- FixedBufferAttribute.cs
- StrongNameIdentityPermission.cs
- X509RawDataKeyIdentifierClause.cs
- InvokeDelegate.cs
- DateTimeOffsetStorage.cs
- MetadataProperty.cs
- TextEditorDragDrop.cs
- UnsafePeerToPeerMethods.cs
- WorkflowInstance.cs
- TypeListConverter.cs
- Control.cs
- RegisteredHiddenField.cs
- EnumerableRowCollectionExtensions.cs
- OrderedDictionary.cs
- DataSourceGroupCollection.cs
- Matrix3DValueSerializer.cs
- streamingZipPartStream.cs
- ButtonFieldBase.cs
- PriorityItem.cs
- Int64KeyFrameCollection.cs
- DataGridViewComboBoxEditingControl.cs
- MenuItemBinding.cs
- AggregateNode.cs
- ReceiveSecurityHeaderEntry.cs
- SoapSchemaImporter.cs
- NumericUpDownAccelerationCollection.cs
- DtdParser.cs
- _HelperAsyncResults.cs
- RefreshPropertiesAttribute.cs
- PresentationUIStyleResources.cs
- DragEvent.cs
- XmlIlTypeHelper.cs
- SqlDataRecord.cs
- NumberFormatInfo.cs
- ByteConverter.cs
- WebPartChrome.cs
- BaseTemplateParser.cs
- InputProviderSite.cs
- PriorityChain.cs
- UpDownBase.cs
- CopyOnWriteList.cs
- IxmlLineInfo.cs
- KeySplineConverter.cs
- SimpleFileLog.cs
- CodeParameterDeclarationExpression.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- XmlBinaryWriterSession.cs
- TypeRefElement.cs
- CommandEventArgs.cs
- DescendantOverDescendantQuery.cs
- ToolStripPanelRow.cs
- Pair.cs
- EntityUtil.cs
- DataRecordInternal.cs
- SystemEvents.cs
- BindingObserver.cs
- UserControlBuildProvider.cs
- DocumentXmlWriter.cs
- MediaSystem.cs
- OdbcStatementHandle.cs
- WSFederationHttpBinding.cs
- PathGeometry.cs
- MetadataWorkspace.cs
- ClientConfigurationHost.cs
- XmlNotation.cs
- TextBlock.cs
- AssemblySettingAttributes.cs
- EventDescriptor.cs
- TimeZone.cs
- DoubleCollectionConverter.cs
- ModulesEntry.cs
- RegexGroupCollection.cs
- TypeSystem.cs
- DataTableClearEvent.cs
- InvalidCommandTreeException.cs
- CalendarDay.cs
- Size3D.cs
- StreamAsIStream.cs
- ProviderCollection.cs
- ExpressionNode.cs
- ProtocolElement.cs
- ComplexTypeEmitter.cs
- KnownTypeHelper.cs
- JoinCqlBlock.cs
- Pens.cs
- XmlSchemaSubstitutionGroup.cs
- RTLAwareMessageBox.cs
- Bold.cs
- TrustManagerPromptUI.cs
- UICuesEvent.cs
- MappingSource.cs
- XmlSchemaGroup.cs
- WebPartTransformer.cs
- ParameterBuilder.cs
- GreenMethods.cs
- ComboBox.cs
- Ticks.cs
- NameValueConfigurationElement.cs