1 //---------------------------------------------------------------------
2 // <copyright file="GlobalItem.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
10 using System.Collections.Generic;
11 using System.Collections.ObjectModel;
12 using System.Data.Common;
13 using System.Diagnostics;
15 using System.Xml.Serialization;
16 using System.Xml.Schema;
19 namespace System.Data.Metadata.Edm
22 /// Represents the base item class for all the metadata
24 public abstract class GlobalItem : MetadataItem
28 /// Implementing this internal constructor so that this class can't be derived
29 /// outside this assembly
35 internal GlobalItem(MetadataFlags flags)
44 /// Returns the DataSpace in which this type belongs to
46 [MetadataProperty(typeof(DataSpace), false)]
47 internal DataSpace DataSpace
51 // Since there can be row types that span across spaces and we can have collections to such row types, we need to exclude RowType and collection type in this assert check
52 Debug.Assert(GetDataSpace() != (DataSpace)(-1) || this.BuiltInTypeKind == BuiltInTypeKind.RowType || this.BuiltInTypeKind == BuiltInTypeKind.CollectionType, "DataSpace must have some valid value");
53 return GetDataSpace();
57 // Whenever you assign the data space value, it must be unassigned or re-assigned to the same value.
58 // The only exception being we sometimes need to create row types that contains types from various spaces
59 Debug.Assert(GetDataSpace() == (DataSpace)(-1) || GetDataSpace() == value || this.BuiltInTypeKind == BuiltInTypeKind.RowType || this.BuiltInTypeKind == BuiltInTypeKind.CollectionType, "Invalid Value being set for DataSpace");