Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / CollectionType.cs / 1305376 / CollectionType.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Data.Common; using System.Text; namespace System.Data.Metadata.Edm { ////// Represents the Edm Collection Type /// public sealed class CollectionType : EdmType { #region Constructors ////// The constructor for constructing a CollectionType object with the element type it contains /// /// The element type that this collection type contains ///Thrown if the argument elementType is null internal CollectionType(EdmType elementType) : this(TypeUsage.Create(elementType)) { this.DataSpace = elementType.DataSpace; } ////// The constructor for constructing a CollectionType object with the element type (as a TypeUsage) it contains /// /// The element type that this collection type contains ///Thrown if the argument elementType is null internal CollectionType(TypeUsage elementType) : base(GetIdentity(EntityUtil.GenericCheckArgumentNull(elementType, "elementType")), EdmConstants.TransientNamespace, elementType.EdmType.DataSpace) { _typeUsage = elementType; SetReadOnly(); } #endregion #region Fields private readonly TypeUsage _typeUsage; #endregion #region Properties ////// Returns the kind of the type /// public override BuiltInTypeKind BuiltInTypeKind { get { return BuiltInTypeKind.CollectionType; } } ////// The type of the element that this collection type contains /// [MetadataProperty(BuiltInTypeKind.TypeUsage, false)] public TypeUsage TypeUsage { get { return _typeUsage; } } #endregion #region Methods ////// Constructs the name of the collection type /// /// The typeusage for the element type that this collection type refers to ///The identity of the resulting collection type private static string GetIdentity(TypeUsage typeUsage) { StringBuilder builder = new StringBuilder(50); builder.Append("collection["); typeUsage.BuildIdentity(builder); builder.Append("]"); return builder.ToString(); } ////// Override EdmEquals to support value comparison of TypeUsage property /// /// ///internal override bool EdmEquals(MetadataItem item) { // short-circuit if this and other are reference equivalent if (Object.ReferenceEquals(this, item)) { return true; } // check type of item if (null == item || BuiltInTypeKind.CollectionType != item.BuiltInTypeKind) { return false; } CollectionType other = (CollectionType)item; // compare type usage return this.TypeUsage.EdmEquals(other.TypeUsage); } #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
- FixUp.cs
- ExceptionRoutedEventArgs.cs
- SkinIDTypeConverter.cs
- SQLGuid.cs
- PeerInvitationResponse.cs
- Vector3DCollectionConverter.cs
- SqlInternalConnectionSmi.cs
- SQLRoleProvider.cs
- DocumentScope.cs
- EncodingFallbackAwareXmlTextWriter.cs
- dataprotectionpermission.cs
- SelectingProviderEventArgs.cs
- SourceLineInfo.cs
- OdbcHandle.cs
- ThemeConfigurationDialog.cs
- ResolvePPIDRequest.cs
- TreeWalker.cs
- OracleConnectionFactory.cs
- DbExpressionRules.cs
- FlowDocumentPage.cs
- TreeViewAutomationPeer.cs
- AssemblyHash.cs
- Int32.cs
- LinkButton.cs
- CharEntityEncoderFallback.cs
- TemplateBaseAction.cs
- XmlSchemaType.cs
- AxisAngleRotation3D.cs
- InheritanceContextHelper.cs
- SpinWait.cs
- EncoderParameter.cs
- XPathAncestorIterator.cs
- ScriptReferenceEventArgs.cs
- DbProviderServices.cs
- InstanceCreationEditor.cs
- TypedElement.cs
- TriState.cs
- SqlDeflator.cs
- __FastResourceComparer.cs
- FrameworkElement.cs
- ExistsInCollection.cs
- ClientScriptManagerWrapper.cs
- UnmanagedBitmapWrapper.cs
- ServiceDescriptionImporter.cs
- SqlDependency.cs
- SynchronizedInputHelper.cs
- AdPostCacheSubstitution.cs
- TypefaceCollection.cs
- HttpDateParse.cs
- DefaultProxySection.cs
- MenuItemBinding.cs
- Intellisense.cs
- FileDialog.cs
- AdornerPresentationContext.cs
- PageStatePersister.cs
- RegexCaptureCollection.cs
- SkewTransform.cs
- ConnectionManagementElementCollection.cs
- Mapping.cs
- TypeCodeDomSerializer.cs
- CharUnicodeInfo.cs
- InplaceBitmapMetadataWriter.cs
- ChtmlPageAdapter.cs
- ResourceContainer.cs
- TransactionManager.cs
- ServicePointManager.cs
- Soap.cs
- MetadataCollection.cs
- WindowsEditBox.cs
- MenuRenderer.cs
- RtType.cs
- XmlPreloadedResolver.cs
- GridItemProviderWrapper.cs
- SqlCommand.cs
- VerticalAlignConverter.cs
- DataGridViewDataConnection.cs
- CommonDialog.cs
- OutputCacheSettingsSection.cs
- ResumeStoryboard.cs
- DbInsertCommandTree.cs
- ArraySubsetEnumerator.cs
- XmlSchemaElement.cs
- DbProviderFactories.cs
- HwndSubclass.cs
- PointCollection.cs
- TextEmbeddedObject.cs
- CfgArc.cs
- Helpers.cs
- MouseEventArgs.cs
- PropVariant.cs
- RegexCharClass.cs
- StylesEditorDialog.cs
- NamespaceInfo.cs
- UniqueEventHelper.cs
- MessageAction.cs
- WasAdminWrapper.cs
- LineInfo.cs
- VirtualDirectoryMapping.cs
- XmlHierarchyData.cs
- RichTextBoxAutomationPeer.cs