번역 제안
 
다른 사람들의 제안:

progress indicator
다른 제안이 없습니다.
평가 및 의견을 보내려면 클릭하십시오.
MSDN
MSDN Library
.NET 개발
.NET Framework 4
.NET Framework 클래스 라이브러리
System.Data 네임스페이스
System.Data.Metadata.Edm
GlobalItem 클래스
모두 축소/모두 확장 모두 축소
내용 보기:  나란히내용 보기: 나란히
.NET Framework Class Library
GlobalItem Class

Represents the base item class for all the conceptual model types and entity containers.

Namespace:  System.Data.Metadata.Edm
Assembly:  System.Data.Entity (in System.Data.Entity.dll)
Visual Basic
Public MustInherit Class GlobalItem _
    Inherits MetadataItem
C#
public abstract class GlobalItem : MetadataItem
Visual C++
public ref class GlobalItem abstract : public MetadataItem
F#
[<AbstractClass>]
type GlobalItem =  
    class
        inherit MetadataItem
    end

The GlobalItem type exposes the following members.

  NameDescription
Public propertyBuiltInTypeKindGets the built-in type kind for this type. (Inherited from MetadataItem.)
Public propertyDocumentationGets or sets the documentation associated with this type. (Inherited from MetadataItem.)
Public propertyMetadataPropertiesGets the list of properties of the current type. (Inherited from MetadataItem.)
Top
  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

For more information, see Metadata Type Hierarchy Overview.

The following code sample demonstrates how to get a metadata workspace from the connection and then use that metadata workspace to browse the metadata type hierarchy. Note that the metadata workspace is a runtime service component that provides support for retrieving metadata.

The code sample uses a CSpace to specify the model. The CSpace represents the default name for the conceptual model. The code sample uses the connection string that is provided in the application config file. For an example of the application config file, see Adventure Works Object Model in Applications (EDM).

C#
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;
       }
    }
  }
}

.NET Framework

Supported in: 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
.NET Framework 클래스 라이브러리
GlobalItem 클래스

모든 개념적 모델 형식과 엔터티 컨테이너의 기본 항목 클래스를 나타냅니다.

네임스페이스:  System.Data.Metadata.Edm
어셈블리:  System.Data.Entity(System.Data.Entity.dll)
Visual Basic
Public MustInherit Class GlobalItem _
    Inherits MetadataItem
C#
public abstract class GlobalItem : MetadataItem
Visual C++
public ref class GlobalItem abstract : public MetadataItem
F#
[<AbstractClass>]
type GlobalItem =  
    class
        inherit MetadataItem
    end

GlobalItem 형식에서는 다음과 같은 멤버를 노출합니다.

  이름설명
Public 속성BuiltInTypeKind이 형식의 기본 제공 형식 유형을 가져옵니다. (MetadataItem에서 상속됨)
Public 속성Documentation이 형식과 관련된 설명서를 가져오거나 설정합니다. (MetadataItem에서 상속됨)
Public 속성MetadataProperties현재 형식의 속성 목록을 가져옵니다. (MetadataItem에서 상속됨)
위쪽
  이름설명
Public 메서드Equals(Object)지정한 Object가 현재 Object와 같은지 여부를 확인합니다. (Object에서 상속됨)
Protected 메서드Finalize가비지 수집에서 회수하기 전에 개체에서 리소스를 해제하고 다른 정리 작업을 수행할 수 있게 합니다. (Object에서 상속됨)
Public 메서드GetHashCode특정 형식에 대한 해시 함수 역할을 합니다. (Object에서 상속됨)
Public 메서드GetType현재 인스턴스의 Type을 가져옵니다. (Object에서 상속됨)
Protected 메서드MemberwiseClone현재 Object의 단순 복사본을 만듭니다. (Object에서 상속됨)
Public 메서드ToString현재 개체를 나타내는 문자열을 반환합니다. (Object에서 상속됨)
위쪽

자세한 내용은 Metadata Type Hierarchy Overview을 참조하십시오.

다음 코드 샘플에서는 연결에서 메타데이터 작업 영역을 가져온 다음 이 메타데이터 작업 영역을 사용하여 메타데이터 형식 계층 구조를 탐색하는 방법을 보여 줍니다. 메타데이터 작업 영역은 메타데이터 검색을 지원하는 런타임 서비스 구성 요소입니다.

이 코드 예제에서는 CSpace를 사용하여 모델을 지정합니다. CSpace는 개념적 모델의 기본 이름을 나타냅니다. 코드 샘플에서는 응용 프로그램 구성 파일에서 제공되는 연결 문자열을 사용합니다. 응용 프로그램 구성 파일의 예제를 보려면 Adventure Works Object Model in Applications (EDM)을를 참조하십시오.

C#
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;
       }
    }
  }
}

.NET Framework

4, 3.5 SP1에서 지원

.NET Framework Client Profile

4에서 지원

Windows 7, Windows Vista SP1 이상, Windows XP SP3, Windows Server 2008(Server Core는 지원되지 않음), Windows Server 2008 R2(Server Core는 SP1 이상에서 지원됨), Windows Server 2003 SP2

.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
커뮤니티 콘텐츠   커뮤니티 콘텐츠란?
새 콘텐츠 추가 RSS  주석
Processing
© 2012 Microsoft. 모든 권리 보유. 사용약관 | 상표 | 개인정보취급방침 및 청소년보호정책
Page view tracker