Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / CollectionType.cs / 1 / 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
- Persist.cs
- addressfiltermode.cs
- ConfigXmlComment.cs
- _CommandStream.cs
- PlanCompilerUtil.cs
- DataSpaceManager.cs
- JoinTreeSlot.cs
- HealthMonitoringSection.cs
- ProtectedConfigurationSection.cs
- ResourceDescriptionAttribute.cs
- DocumentStatusResources.cs
- DataRelationCollection.cs
- DesignerVerb.cs
- X509Chain.cs
- EventDescriptorCollection.cs
- DependencyPropertyAttribute.cs
- CannotUnloadAppDomainException.cs
- InlinedAggregationOperator.cs
- WebPartChrome.cs
- DbConnectionPoolIdentity.cs
- ServiceDurableInstanceContextProvider.cs
- TailCallAnalyzer.cs
- AddressingVersion.cs
- MetadataArtifactLoaderFile.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- XmlValidatingReader.cs
- XmlWriterTraceListener.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- QilInvokeLateBound.cs
- SafeReversePInvokeHandle.cs
- ListItemConverter.cs
- Registry.cs
- Internal.cs
- QueryReaderSettings.cs
- RestHandler.cs
- LinqDataSourceEditData.cs
- XamlWriter.cs
- NumericUpDownAcceleration.cs
- TextDecorationUnitValidation.cs
- QuestionEventArgs.cs
- PointAnimationUsingPath.cs
- EmbeddedMailObject.cs
- TokenCreationParameter.cs
- Typography.cs
- TCPListener.cs
- PageCatalogPart.cs
- AsyncSerializedWorker.cs
- HashCodeCombiner.cs
- SiteIdentityPermission.cs
- MarkupCompilePass2.cs
- OleDbConnectionFactory.cs
- TextTreePropertyUndoUnit.cs
- BCLDebug.cs
- PtsCache.cs
- XsdDuration.cs
- Int32CollectionConverter.cs
- ProviderUtil.cs
- DatagridviewDisplayedBandsData.cs
- KeyBinding.cs
- _KerberosClient.cs
- ReaderWriterLock.cs
- WindowsNonControl.cs
- OLEDB_Enum.cs
- ShaperBuffers.cs
- Parser.cs
- UTF32Encoding.cs
- PageRouteHandler.cs
- DataError.cs
- AssemblyCache.cs
- XPathSelfQuery.cs
- TemplateEditingVerb.cs
- BookmarkScopeManager.cs
- TimeSpanStorage.cs
- ResourceManagerWrapper.cs
- PropertyPathConverter.cs
- DoubleLink.cs
- SplitterCancelEvent.cs
- DataPagerFieldCommandEventArgs.cs
- XmlNodeList.cs
- Material.cs
- TimeEnumHelper.cs
- PositiveTimeSpanValidatorAttribute.cs
- GridViewCellAutomationPeer.cs
- SQLDecimal.cs
- SecurityTokenProvider.cs
- KeyedCollection.cs
- ToolStripSplitButton.cs
- PersonalizationDictionary.cs
- TransformerInfoCollection.cs
- Globals.cs
- PageEventArgs.cs
- ConfigurationElementCollection.cs
- TextTreeFixupNode.cs
- ServiceObjectContainer.cs
- OracleSqlParser.cs
- EventDescriptorCollection.cs
- FileAuthorizationModule.cs
- Form.cs
- SqlFactory.cs
- ConfigLoader.cs