Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / CollectionType.cs / 2 / 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
- MissingManifestResourceException.cs
- ApplicationServicesHostFactory.cs
- LinkButton.cs
- SBCSCodePageEncoding.cs
- CodeArrayIndexerExpression.cs
- SqlDataReaderSmi.cs
- TdsParserStaticMethods.cs
- XmlLoader.cs
- Constants.cs
- DynamicDataRoute.cs
- TagPrefixInfo.cs
- DeobfuscatingStream.cs
- CalendarBlackoutDatesCollection.cs
- GridViewSelectEventArgs.cs
- RadialGradientBrush.cs
- CreateInstanceBinder.cs
- WebPartExportVerb.cs
- SimpleHandlerFactory.cs
- EntityTypeBase.cs
- SymmetricAlgorithm.cs
- BehaviorService.cs
- SelectionPattern.cs
- CodeCommentStatement.cs
- ConfigurationPermission.cs
- FacetEnabledSchemaElement.cs
- DataSourceSelectArguments.cs
- FormsAuthenticationCredentials.cs
- ScrollableControl.cs
- TextTreeExtractElementUndoUnit.cs
- ToolStripSystemRenderer.cs
- QuaternionAnimation.cs
- SoapSchemaExporter.cs
- ToolStripDropTargetManager.cs
- OneOfTypeConst.cs
- EndpointAddressElementBase.cs
- Slider.cs
- AutoGeneratedFieldProperties.cs
- StreamingContext.cs
- BitmapEffectDrawing.cs
- MatrixAnimationUsingKeyFrames.cs
- IssuanceTokenProviderState.cs
- regiisutil.cs
- SelectedCellsChangedEventArgs.cs
- FileStream.cs
- ExpressionEditor.cs
- MenuRenderer.cs
- MailWebEventProvider.cs
- TransformGroup.cs
- DbMetaDataColumnNames.cs
- prompt.cs
- EmbeddedMailObjectsCollection.cs
- StringStorage.cs
- ValidationResult.cs
- IdentityNotMappedException.cs
- SortDescription.cs
- DispatcherObject.cs
- StringFreezingAttribute.cs
- SharedUtils.cs
- ContextMenuService.cs
- URLEditor.cs
- UniqueIdentifierService.cs
- PopOutPanel.cs
- DataGridViewElement.cs
- JapaneseLunisolarCalendar.cs
- QilIterator.cs
- RequestCachePolicy.cs
- CodeGenerator.cs
- FixedHighlight.cs
- TabControlEvent.cs
- Schema.cs
- XmlValueConverter.cs
- ThreadPool.cs
- OracleConnectionString.cs
- Inline.cs
- Processor.cs
- PersonalizationProviderHelper.cs
- MetabaseReader.cs
- CallInfo.cs
- ManipulationDeltaEventArgs.cs
- ButtonPopupAdapter.cs
- MessageDecoder.cs
- FillBehavior.cs
- VariableDesigner.xaml.cs
- hresults.cs
- XmlCharType.cs
- SQLCharsStorage.cs
- BitmapData.cs
- SafeViewOfFileHandle.cs
- Geometry.cs
- ControllableStoryboardAction.cs
- XmlWriterDelegator.cs
- QueryFunctions.cs
- XPathNavigatorException.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- DynamicRendererThreadManager.cs
- RectangleHotSpot.cs
- WrappedOptions.cs
- StructureChangedEventArgs.cs
- JoinQueryOperator.cs
- EmissiveMaterial.cs