다음을 통해 공유


TagPrefixInfo 클래스

정의

태그 관련 정보를 포함하는 구성 요소를 정의합니다.

public ref class TagPrefixInfo sealed : System::Configuration::ConfigurationElement
public sealed class TagPrefixInfo : System.Configuration.ConfigurationElement
type TagPrefixInfo = class
    inherit ConfigurationElement
Public NotInheritable Class TagPrefixInfo
Inherits ConfigurationElement
상속

예제

이 예제에서는 클래스의 TagPrefixInfo 멤버로 액세스할 수도 있는 섹션의 여러 특성에 controls 대해 선언적으로 값을 지정하는 방법을 보여 줍니다.

<system.web>
  <pages>
    <controls>
      <!-- Searches all linked assemblies for the namespace -->
      <add tagPrefix="MyTags1" namespace=" MyNameSpace "/>
      <!-- Uses a specified assembly -->
      <add tagPrefix="MyTags2" namespace="MyNameSpace"
        assembly="MyAssembly"/>
      <!-- Uses the specified source for the user control -->
      <add tagprefix="MyTags3" tagname="MyCtrl" src="MyControl.ascx"/>
    </controls>
   </pages>
</system.web>

다음 코드 예제에서는 프로그래밍 방식으로 태그 접두사 설정을 수정 하는 클래스를 사용 TagPrefixInfo 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 PagesSection 일부입니다.

// Get all current Controls in the collection.
for (int i = 0; i < pagesSection.Controls.Count; i++)
{
  Console.WriteLine("Control {0}:", i);
  Console.WriteLine("  TagPrefix = '{0}' ",
      pagesSection.Controls[i].TagPrefix);
  Console.WriteLine("  TagName = '{0}' ",
      pagesSection.Controls[i].TagName);
  Console.WriteLine("  Source = '{0}' ",
      pagesSection.Controls[i].Source);
  Console.WriteLine("  Namespace = '{0}' ",
      pagesSection.Controls[i].Namespace);
  Console.WriteLine("  Assembly = '{0}' ",
      pagesSection.Controls[i].Assembly);
}

// Create a new TagPrefixInfo object.
System.Web.Configuration.TagPrefixInfo tagPrefixInfo =
    new System.Web.Configuration.TagPrefixInfo("MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", "MyControl.ascx");

// Execute the Add Method.
pagesSection.Controls.Add(tagPrefixInfo);

// Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add(
    new System.Web.Configuration.TagPrefixInfo(
    "MyCtrl", "MyNameSpace", "MyAssembly", "MyControl",
    "MyControl.ascx"));
' Get all current Controls in the collection.
Dim j As Int32
For j = 0 To pagesSection.Controls.Count - 1
  Console.WriteLine("Control {0}:", j)
  Console.WriteLine("  TagPrefix = '{0}' ", _
   pagesSection.Controls(j).TagPrefix)
  Console.WriteLine("  TagName = '{0}' ", _
   pagesSection.Controls(j).TagName)
  Console.WriteLine("  Source = '{0}' ", _
   pagesSection.Controls(j).Source)
  Console.WriteLine("  Namespace = '{0}' ", _
   pagesSection.Controls(j).Namespace)
  Console.WriteLine("  Assembly = '{0}' ", _
   pagesSection.Controls(j).Assembly)
Next

' Create a new TagPrefixInfo object.
Dim tagPrefixInfo As System.Web.Configuration.TagPrefixInfo = _
 New System.Web.Configuration.TagPrefixInfo("MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", "MyControl.ascx")

' Execute the Add Method.
pagesSection.Controls.Add(tagPrefixInfo)

' Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add( _
 New System.Web.Configuration.TagPrefixInfo( _
 "MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", _
 "MyControl.ascx"))

설명

TagPrefixInfo 클래스를 사용하면 구성 파일에 저장된 태그 접두사 정보에 프로그래밍 방식으로 액세스하고 수정할 수 있습니다. ASP.NET @Register 지시문과 동일한 기능을 제공합니다. 태그 접두사는 ASP.NET "네임스페이스"를 사용자 지정 컨트롤 및 사용자 정의 컨트롤이 제대로 작동하려면 포함해야 하는 어셈블리 및 네임스페이스에 연결합니다. TagPrefixInfo 개체는 개체의 TagPrefixCollection 멤버로 저장됩니다. 이 TagPrefixCollection 클래스를 사용하면 구성 파일 섹션의 하위 섹션에 controls 프로그래밍 방식으로 액세스하고 수정할 pages 수 있습니다.

TagPrefixInfo 개체는 요소를 사용하여 컬렉션에 add 추가되고 다른 관련 특성에 tagPrefix 대한 값과 함께 특성의 값을 지정합니다. 다른 필수 정보는 지정된 태그 접두사에 사용할 컨트롤의 종류에 따라 달라집니다.

  • 사용자 컨트롤인 경우 , TagNameSource 속성을 정의TagPrefix해야 합니다.

  • 사용자 지정 컨트롤인 경우 , NamespaceAssembly 속성을 정의TagPrefix해야 합니다. Assembly 컨트롤이 애플리케이션 코드 디렉터리에 있는 경우 속성이 필요하지 않습니다.

동일한 tagPrefix 값을 사용하여 여러 어셈블리 또는 네임스페이스에 매핑할 수 있습니다.

메모

원본을 지정하면 사용자 컨트롤 자체가 페이지와 동일한 디렉터리에 있으면 안 됩니다. 이 경우 페이지를 로드하려고 할 때 런타임 오류가 발생합니다.

생성자

Name Description
TagPrefixInfo(String, String, String, String, String)

전달된 값을 사용하여 클래스의 TagPrefixInfo 새 인스턴스를 초기화합니다.

속성

Name Description
Assembly

컨트롤 구현을 포함하는 어셈블리의 이름을 가져오거나 설정합니다.

CurrentConfiguration

현재 Configuration 인스턴스가 속한 구성 계층 구조를 나타내는 최상위 ConfigurationElement 인스턴스에 대한 참조를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ElementInformation

개체의 ElementInformation 사용자 지정할 수 없는 정보 및 기능을 포함하는 개체를 ConfigurationElement 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ElementProperty

ConfigurationElementProperty 개체 자체를 나타내는 개체를 ConfigurationElement 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
EvaluationContext

ContextInformation 개체에 대한 ConfigurationElement 개체를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
HasContext

속성CurrentConfiguration이 .인지 여부를 null 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
Item[ConfigurationProperty]

이 구성 요소의 속성 또는 특성을 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
Item[String]

이 구성 요소의 속성, 특성 또는 자식 요소를 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
LockAllAttributesExcept

잠긴 특성의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockAllElementsExcept

잠긴 요소의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockAttributes

잠긴 특성의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockElements

잠긴 요소의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockItem

요소가 잠겨 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
Namespace

컨트롤이 있는 네임스페이스를 가져오거나 설정합니다.

Properties

속성의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
Source

사용자 컨트롤을 포함하는 파일의 이름과 경로를 가져오거나 설정합니다.

TagName

사용자 컨트롤의 이름을 가져오거나 설정합니다.

TagPrefix

소스 파일 또는 네임스페이스 및 어셈블리와 연결된 태그 접두사를 가져오거나 설정합니다.

메서드

Name Description
DeserializeElement(XmlReader, Boolean)

구성 파일에서 XML을 읽습니다.

(다음에서 상속됨 ConfigurationElement)
Equals(Object)

이 인스턴스를 다른 개체와 비교합니다.

GetHashCode()

현재 인스턴스의 해시 값을 반환합니다.

GetTransformedAssemblyString(String)

지정된 어셈블리 이름의 변환된 버전을 반환합니다.

(다음에서 상속됨 ConfigurationElement)
GetTransformedTypeString(String)

지정된 형식 이름의 변환된 버전을 반환합니다.

(다음에서 상속됨 ConfigurationElement)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
Init()

개체를 ConfigurationElement 초기 상태로 설정합니다.

(다음에서 상속됨 ConfigurationElement)
InitializeDefault()

개체의 기본 값 집합을 ConfigurationElement 초기화하는 데 사용됩니다.

(다음에서 상속됨 ConfigurationElement)
IsModified()

파생 클래스에서 구현된 경우 이 구성 요소가 마지막으로 저장되었거나 로드된 이후 수정되었는지 여부를 나타냅니다.

(다음에서 상속됨 ConfigurationElement)
IsReadOnly()

개체가 읽기 전용인지 여부를 ConfigurationElement 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ListErrors(IList)

ConfigurationElement 개체 및 모든 하위 요소의 잘못된 속성 오류를 전달된 목록에 추가합니다.

(다음에서 상속됨 ConfigurationElement)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnDeserializeUnrecognizedAttribute(String, String)

역직렬화하는 동안 알 수 없는 특성이 발생하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

역직렬화하는 동안 알 수 없는 요소가 발생하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
OnRequiredPropertyNotFound(String)

필수 속성을 찾을 수 없는 경우 예외를 throw합니다.

(다음에서 상속됨 ConfigurationElement)
PostDeserialize()

역직렬화 후 호출됩니다.

(다음에서 상속됨 ConfigurationElement)
PreSerialize(XmlWriter)

serialization 전에 호출됩니다.

(다음에서 상속됨 ConfigurationElement)
Reset(ConfigurationElement)

잠금 및 속성 컬렉션을 포함하여 개체의 ConfigurationElement 내부 상태를 다시 설정합니다.

(다음에서 상속됨 ConfigurationElement)
ResetModified()

파생 클래스에서 구현될 때 메서드 IsModified() 값을 false 다시 설정합니다.

(다음에서 상속됨 ConfigurationElement)
SerializeElement(XmlWriter, Boolean)

파생 클래스에서 구현될 때 이 구성 요소의 내용을 구성 파일에 씁니다.

(다음에서 상속됨 ConfigurationElement)
SerializeToXmlElement(XmlWriter, String)

파생 클래스에서 구현될 때 이 구성 요소의 외부 태그를 구성 파일에 씁니다.

(다음에서 상속됨 ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

속성을 지정된 값으로 설정합니다.

(다음에서 상속됨 ConfigurationElement)
SetReadOnly()

IsReadOnly() 개체 및 모든 하위 요소의 ConfigurationElement 속성을 설정합니다.

(다음에서 상속됨 ConfigurationElement)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

개체를 ConfigurationElement 수정하여 저장해서는 안 되는 모든 값을 제거합니다.

(다음에서 상속됨 ConfigurationElement)

적용 대상

추가 정보