GlobalItem クラス

定義

すべての概念モデル型とエンティティ コンテナーの基本項目クラスを表します。

public ref class GlobalItem abstract : System::Data::Metadata::Edm::MetadataItem
public abstract class GlobalItem : System.Data.Metadata.Edm.MetadataItem
type GlobalItem = class
    inherit MetadataItem
Public MustInherit Class GlobalItem
Inherits MetadataItem
継承
GlobalItem
派生

次のコード サンプルでは、接続からメタデータ ワークスペースを取得した後、そのメタデータ ワークスペースを使用して、メタデータ型階層を参照します。 メタデータ ワークスペースは、メタデータの取得をサポートするランタイム サービス コンポーネントです。

このコード サンプルでは、CSpace を使用してモデルを指定します。 CSpace は、概念モデルの既定の名前を表します。 このコード サンプルでは、アプリケーション構成ファイルで提供されている接続文字列を使用します。

using System;  
using System.Data;  
using System.Data.EntityClient;  
using System.Data.Metadata.Edm;  
using System.Collections.ObjectModel;  

class BrowseTypes  
{  
  static void Main()  
  {  
    try  
    {  
      // Establish a connection to the underlying data provider by  
      // using the connection string specified in the config file.  
      using (EntityConnection connection =  
             new EntityConnection("Name=AdventureworksContext"))  
      {  
         // Access the metadata workspace.  
         MetadataWorkspace workspace =   
              connection.GetMetadataWorkspace();  
         // Browse the metadata type hierarchy.  
         BrowseTypesExample(workspace);  
      }  
    }  
    catch (MetadataException exceptionMetadata)  
    {  
       Console.WriteLine("MetadataException: {0}",  
                         exceptionMetadata.Message);  
     }  
     catch (System.Data.MappingException exceptionMapping)  
     {  
        Console.WriteLine("MappingException: {0}",  
                          exceptionMapping.Message);  
     }  
  }  

  private static void BrowseTypesExample(MetadataWorkspace workspace)  
  {  
    // Get a collection of the GlobalItems.   
    // An GlobalItem class is the base class for   
    // the conceptual model types and entity containers.  
    ReadOnlyCollection<GlobalItem> items =   
         workspace.GetItems<GlobalItem>(DataSpace.CSpace);  

    // Iterate through the collection to get each item.  
    foreach (GlobalItem item in items)  
    {  
       Console.WriteLine(  
           "Item BuiltInTypeKind: {0}, Type: {1} ",   
           item.BuiltInTypeKind, item.GetType().FullName);  

       EntityContainer entityContainer = item as EntityContainer;  
       if (entityContainer != null)  
       {  
          Console.WriteLine(  
               "EntityContainer Name: {0}",  
               entityContainer.Name);  
          continue;  
       }  

       EntityType entityType = item as EntityType;  
       if (entityType != null)  
       {  
         Console.WriteLine(  
             "EntityType Name: {0}, Namespace: {1}",  
             entityType.Name, entityType.NamespaceName);  
        continue;  
       }  

       AssociationType associationType = item as AssociationType;  
       if (associationType != null)  
       {  
          Console.WriteLine(  
             "AssociationType Name: {0}, Namespace: {1}",  
             associationType.Name, associationType.NamespaceName);  
          continue;  
       }  

       PrimitiveType primType = item as PrimitiveType;  
       if (primType != null)  
       {  
         Console.WriteLine(  
             "PrimitiveType Name: {0}, Namespace: {1}",   
             primType.Name, primType.NamespaceName);  
         continue;  
       }  

       EdmFunction function = item as EdmFunction;  
       if (function != null)  
       {  
         Console.WriteLine(  
           "EdmFunction Name: {0}, Namespace: {1}",  
           function.Name, function.NamespaceName);  
         continue;  
       }  
    }  
  }  
}  

プロパティ

BuiltInTypeKind

この型の組み込み型種別を取得します。

(継承元 MetadataItem)
Documentation

この型に関連付けられているドキュメントを取得または設定します。

(継承元 MetadataItem)
MetadataProperties

現在の型のプロパティの一覧を取得します。

(継承元 MetadataItem)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象