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
- PlainXmlSerializer.cs
- WebPartConnectionsConfigureVerb.cs
- LoginName.cs
- PagerSettings.cs
- JpegBitmapDecoder.cs
- UserControlDocumentDesigner.cs
- MultidimensionalArrayItemReference.cs
- AbstractExpressions.cs
- NumericPagerField.cs
- TreeViewTemplateSelector.cs
- SqlGenericUtil.cs
- ScriptingScriptResourceHandlerSection.cs
- XPathParser.cs
- WorkItem.cs
- ElementHostPropertyMap.cs
- ViewLoader.cs
- BackStopAuthenticationModule.cs
- TextRangeBase.cs
- RoutingTable.cs
- DesignerAttribute.cs
- HttpClientProtocol.cs
- ProviderUtil.cs
- listitem.cs
- SqlDataSourceView.cs
- SmiConnection.cs
- Rect.cs
- TreeIterator.cs
- ProgressBar.cs
- SqlDependencyListener.cs
- TemplatedAdorner.cs
- RadioButton.cs
- DPAPIProtectedConfigurationProvider.cs
- DesignTimeParseData.cs
- SQLInt16Storage.cs
- MenuBase.cs
- DataControlReference.cs
- MenuItemBinding.cs
- Invariant.cs
- Command.cs
- WebHttpBehavior.cs
- TreeIterator.cs
- RC2.cs
- DetailsView.cs
- StackSpiller.Temps.cs
- EventSourceCreationData.cs
- MobileErrorInfo.cs
- ManualResetEventSlim.cs
- DeviceContext2.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- FontStretches.cs
- FolderLevelBuildProviderCollection.cs
- XhtmlBasicValidatorAdapter.cs
- Attribute.cs
- RotateTransform.cs
- EventProvider.cs
- ResourceDisplayNameAttribute.cs
- StylusPlugInCollection.cs
- IdleTimeoutMonitor.cs
- NativeMethods.cs
- DataBoundControl.cs
- SystemKeyConverter.cs
- QilList.cs
- QualifierSet.cs
- ValidationEventArgs.cs
- StringStorage.cs
- WebPartManager.cs
- EntityParameter.cs
- DBSchemaTable.cs
- KeyValueConfigurationElement.cs
- TransformConverter.cs
- NodeInfo.cs
- FilterElement.cs
- sortedlist.cs
- WSHttpBindingBase.cs
- SQLRoleProvider.cs
- SqlFacetAttribute.cs
- DebugView.cs
- WebProxyScriptElement.cs
- InheritanceService.cs
- MediaElementAutomationPeer.cs
- WebSysDescriptionAttribute.cs
- VerticalAlignConverter.cs
- LinqToSqlWrapper.cs
- CompilerGeneratedAttribute.cs
- ErrorTableItemStyle.cs
- ErasingStroke.cs
- HttpListenerElement.cs
- MetadataCache.cs
- X509ClientCertificateAuthentication.cs
- Listener.cs
- RijndaelManagedTransform.cs
- LicenseContext.cs
- XmlDataSource.cs
- ConfigPathUtility.cs
- PopOutPanel.cs
- SqlLiftWhereClauses.cs
- Material.cs
- AggregateNode.cs
- DocumentNUp.cs
- ReadContentAsBinaryHelper.cs