Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------- // // 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
- TypeBuilder.cs
- CustomActivityDesigner.cs
- RequestQueryProcessor.cs
- WebPartHelpVerb.cs
- _IPv4Address.cs
- DataReceivedEventArgs.cs
- DateTimeOffsetStorage.cs
- SessionParameter.cs
- ImpersonationContext.cs
- EditorPartCollection.cs
- FigureParaClient.cs
- DefaultEventAttribute.cs
- XamlRtfConverter.cs
- Content.cs
- ContainerFilterService.cs
- WebPartVerbCollection.cs
- TableProviderWrapper.cs
- WindowsListViewScroll.cs
- ToolStripRenderEventArgs.cs
- UnmanagedBitmapWrapper.cs
- StateItem.cs
- PolicyException.cs
- ConfigurationLocationCollection.cs
- GatewayDefinition.cs
- WorkflowOwnerAsyncResult.cs
- odbcmetadatafactory.cs
- ClientCultureInfo.cs
- ServiceProviders.cs
- NavigationEventArgs.cs
- DbParameterHelper.cs
- PageCodeDomTreeGenerator.cs
- DoubleAnimation.cs
- RegisteredHiddenField.cs
- SmiMetaData.cs
- cookie.cs
- GeometryModel3D.cs
- UpdateEventArgs.cs
- XsltContext.cs
- FunctionUpdateCommand.cs
- XamlTypeMapper.cs
- DocumentGridPage.cs
- DataGridViewColumnHeaderCell.cs
- StdValidatorsAndConverters.cs
- SoapExtensionReflector.cs
- HtmlTableCellCollection.cs
- GenericsNotImplementedException.cs
- FontSource.cs
- Funcletizer.cs
- SelectionRange.cs
- ForwardPositionQuery.cs
- DispatcherFrame.cs
- HtmlInputControl.cs
- AppDomainResourcePerfCounters.cs
- ByteRangeDownloader.cs
- ContractHandle.cs
- CapiHashAlgorithm.cs
- TabControlCancelEvent.cs
- OdbcConnectionStringbuilder.cs
- RealizationContext.cs
- WebPartDisplayMode.cs
- TimeIntervalCollection.cs
- RuntimeCompatibilityAttribute.cs
- GetPageNumberCompletedEventArgs.cs
- Cursor.cs
- DnsCache.cs
- TextChangedEventArgs.cs
- XPathPatternBuilder.cs
- DataGridViewTopLeftHeaderCell.cs
- ObjectQueryState.cs
- DependencyStoreSurrogate.cs
- ConnectionConsumerAttribute.cs
- PersonalizationStateQuery.cs
- ListViewSelectEventArgs.cs
- DeviceContexts.cs
- QueryCacheKey.cs
- DispatchRuntime.cs
- CodeBlockBuilder.cs
- SqlUserDefinedAggregateAttribute.cs
- DataKeyArray.cs
- ListViewSelectEventArgs.cs
- HttpRuntimeSection.cs
- RTLAwareMessageBox.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- SystemFonts.cs
- JournalEntry.cs
- CompositeDataBoundControl.cs
- DurableDispatcherAddressingFault.cs
- AnimationClockResource.cs
- JsonServiceDocumentSerializer.cs
- ClaimTypeRequirement.cs
- TargetParameterCountException.cs
- ExpanderAutomationPeer.cs
- ErrorFormatter.cs
- TextFormatter.cs
- AssociativeAggregationOperator.cs
- TrackingStringDictionary.cs
- BaseCodeDomTreeGenerator.cs
- BamlBinaryWriter.cs
- SqlRetyper.cs
- LinkLabelLinkClickedEvent.cs