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
- Queue.cs
- XmlMtomWriter.cs
- ListParaClient.cs
- IndexOutOfRangeException.cs
- CanExpandCollapseAllConverter.cs
- ColorConverter.cs
- SoapIncludeAttribute.cs
- SlipBehavior.cs
- VersionConverter.cs
- ThrowHelper.cs
- FunctionQuery.cs
- OperationAbortedException.cs
- AbsoluteQuery.cs
- BindingCompleteEventArgs.cs
- MatrixTransform.cs
- RegionData.cs
- OleDbCommandBuilder.cs
- SqlEnums.cs
- ScriptHandlerFactory.cs
- DateTimeOffset.cs
- VisualStyleRenderer.cs
- DesignerRegion.cs
- XmlProcessingInstruction.cs
- HandlerBase.cs
- RMEnrollmentPage3.cs
- GroupLabel.cs
- MenuScrollingVisibilityConverter.cs
- CqlParserHelpers.cs
- AsyncOperation.cs
- ProjectionPlan.cs
- PageFunction.cs
- TextPointerBase.cs
- ZipIOFileItemStream.cs
- HtmlElement.cs
- _SingleItemRequestCache.cs
- SupportingTokenSecurityTokenResolver.cs
- ExpressionConverter.cs
- ImportRequest.cs
- RemotingSurrogateSelector.cs
- ClassData.cs
- ResXDataNode.cs
- MultilineStringConverter.cs
- ErasingStroke.cs
- InternalPolicyElement.cs
- XmlAttributeOverrides.cs
- DetailsViewInsertEventArgs.cs
- UncommonField.cs
- InstanceKeyView.cs
- DefinitionBase.cs
- DataGridViewAdvancedBorderStyle.cs
- ChtmlPageAdapter.cs
- ButtonRenderer.cs
- XmlParserContext.cs
- Compiler.cs
- CAGDesigner.cs
- LinkButton.cs
- BooleanExpr.cs
- CalendarDay.cs
- AssemblyHelper.cs
- MenuItemBinding.cs
- TemplateControlCodeDomTreeGenerator.cs
- SqlBuilder.cs
- FactoryRecord.cs
- CorrelationService.cs
- Int32Storage.cs
- SourceChangedEventArgs.cs
- HtmlLinkAdapter.cs
- TraceListener.cs
- ButtonRenderer.cs
- AppDomainCompilerProxy.cs
- ErrorHandler.cs
- PipeStream.cs
- HttpFileCollection.cs
- MouseCaptureWithinProperty.cs
- NativeMethods.cs
- DataServiceException.cs
- CollectionsUtil.cs
- NativeWindow.cs
- ObfuscateAssemblyAttribute.cs
- Fault.cs
- Timer.cs
- CodeFieldReferenceExpression.cs
- ListParaClient.cs
- ItemDragEvent.cs
- GlyphRun.cs
- PersonalizationStateInfo.cs
- BamlResourceContent.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- figurelength.cs
- MouseEventArgs.cs
- WaitForChangedResult.cs
- XPathParser.cs
- Model3D.cs
- QilDataSource.cs
- Lock.cs
- DefaultSection.cs
- WebPartCloseVerb.cs
- ControlBindingsConverter.cs
- PDBReader.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs