Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / CollectionType.cs / 3 / CollectionType.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- 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 [....], [....] //--------------------------------------------------------------------- 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
- RefExpr.cs
- XmlDigitalSignatureProcessor.cs
- NativeMethods.cs
- WriterOutput.cs
- HtmlDocument.cs
- AssociationTypeEmitter.cs
- SchemaNotation.cs
- AuthenticationService.cs
- HttpsChannelListener.cs
- HGlobalSafeHandle.cs
- ProtocolsConfiguration.cs
- HttpServerVarsCollection.cs
- TreeView.cs
- IOThreadScheduler.cs
- RSAPKCS1KeyExchangeFormatter.cs
- KeyToListMap.cs
- lengthconverter.cs
- HandledMouseEvent.cs
- StringValueSerializer.cs
- EmptyEnumerator.cs
- UserPreferenceChangingEventArgs.cs
- followingsibling.cs
- DBSchemaTable.cs
- BindValidator.cs
- DurableEnlistmentState.cs
- DPCustomTypeDescriptor.cs
- DataMemberConverter.cs
- InputManager.cs
- SchemaImporterExtensionElement.cs
- BaseConfigurationRecord.cs
- GridViewColumnCollectionChangedEventArgs.cs
- NotSupportedException.cs
- APCustomTypeDescriptor.cs
- BooleanProjectedSlot.cs
- PathSegment.cs
- Char.cs
- DataGridViewCellParsingEventArgs.cs
- HelpProvider.cs
- WebBrowserSiteBase.cs
- StringAnimationUsingKeyFrames.cs
- ViewDesigner.cs
- Random.cs
- DataServiceConfiguration.cs
- DynamicResourceExtension.cs
- PingReply.cs
- InvalidDataException.cs
- XmlSortKeyAccumulator.cs
- EnvelopedPkcs7.cs
- HtmlElementErrorEventArgs.cs
- SingleTagSectionHandler.cs
- CopyAttributesAction.cs
- BinarySerializer.cs
- StyleXamlParser.cs
- ExpandCollapsePattern.cs
- DtdParser.cs
- XmlNotation.cs
- BufferBuilder.cs
- ValidateNames.cs
- XmlDataProvider.cs
- ExpressionEditor.cs
- Int64AnimationBase.cs
- AspNetHostingPermission.cs
- ResourceAssociationSetEnd.cs
- CategoryGridEntry.cs
- ProxyGenerationError.cs
- PersianCalendar.cs
- SmiEventSink_DeferedProcessing.cs
- RIPEMD160Managed.cs
- AutomationProperty.cs
- NoneExcludedImageIndexConverter.cs
- BaseCodeDomTreeGenerator.cs
- FileUtil.cs
- MenuItemBindingCollection.cs
- MimeMultiPart.cs
- XmlWrappingReader.cs
- StylusSystemGestureEventArgs.cs
- SupportingTokenListenerFactory.cs
- WCFBuildProvider.cs
- Mapping.cs
- CodeLinePragma.cs
- CodeBinaryOperatorExpression.cs
- ByteViewer.cs
- InvalidEnumArgumentException.cs
- QilNode.cs
- TypeName.cs
- AsyncResult.cs
- HyperLink.cs
- SQLInt32.cs
- Italic.cs
- FontWeights.cs
- DbDataAdapter.cs
- TemplateBindingExtensionConverter.cs
- WebBrowserUriTypeConverter.cs
- DateTimeFormatInfo.cs
- TemplateColumn.cs
- CompoundFileStreamReference.cs
- FieldNameLookup.cs
- ToolStripContentPanel.cs
- TextTreeObjectNode.cs
- DataBoundLiteralControl.cs