DesignTimeResourceProviderFactoryAttribute クラス
アセンブリ: System.Web (system.web.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class)> _ Public NotInheritable Class DesignTimeResourceProviderFactoryAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)] public sealed class DesignTimeResourceProviderFactoryAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] public ref class DesignTimeResourceProviderFactoryAttribute sealed : public Attribute

DesignTimeResourceProviderFactoryAttribute クラスを使用すると、ResourceProviderFactory オブジェクトで、関連する DesignTimeResourceProviderFactory オブジェクトの型を指定できます。DesignTimeResourceProviderFactory クラスは、リソースの読み書きに使用するデザイン時プロバイダの作成に使用します。Microsoft Visual Studio 2005 内で、[ツール] メニューの [ローカル リソースの生成] コマンドを使用して、デザイン時にリソースを作成できます。

カスタマイズされたリソース プロバイダ ファクトリが DesignTimeResourceProviderFactoryAttribute 属性を使用して、カスタマイズされたデザイン時リソース プロバイダ ファクトリを指定するコード例を次に示します。この例には、カスタマイズされたデザイン時リソース プロバイダ ファクトリの実装に必要なコードは含まれていません。
Imports System Imports System.Collections.Generic Imports System.Text Imports System.Web.Compilation Imports System.Resources Imports System.Globalization Imports System.Collections Imports System.Reflection Imports System.Web.UI.Design Namespace CustomResourceProviders <DesignTimeResourceProviderFactoryAttribute(GetType(CustomDesignTimeResourceProviderFactory))> _ Public Class CustomResourceProviderFactory Inherits ResourceProviderFactory Public Overrides Function CreateGlobalResourceProvider(ByVal classname As String) As IResourceProvider Return New CustomResourceProvider(Nothing, classname) End Function Public Overrides Function CreateLocalResourceProvider(ByVal virtualPath As String) As IResourceProvider Return New CustomResourceProvider(virtualPath, Nothing) End Function End Class ' Define the resource provider for global and local resources. Friend Class CustomResourceProvider Implements IResourceProvider Dim _virtualPath As String Dim _className As String Public Sub New(ByVal virtualPath As String, ByVal classname As String) _virtualPath = virtualPath _className = classname End Sub Private Function GetResourceCache(ByVal culturename As String) As IDictionary Return System.Web.HttpContext.Current.Cache(culturename) End Function Function GetObject(ByVal resourceKey As String, ByVal culture As CultureInfo) As Object Implements IResourceProvider.GetObject Dim value As Object Dim cultureName As String cultureName = Nothing If (IsNothing(culture)) Then cultureName = CultureInfo.CurrentUICulture.Name Else cultureName = culture.Name End If value = GetResourceCache(cultureName)(resourceKey) If (value = Nothing) Then value = GetResourceCache(Nothing)(resourceKey) End If Return value End Function ReadOnly Property ResourceReader() As IResourceReader Implements IResourceProvider.ResourceReader Get Dim cultureName As String Dim currentUICulture As CultureInfo cultureName = Nothing currentUICulture = CultureInfo.CurrentUICulture If (Not (String.Equals(currentUICulture.Name, CultureInfo.InstalledUICulture.Name))) Then cultureName = currentUICulture.Name End If Return New CustomResourceReader(GetResourceCache(cultureName)) End Get End Property End Class Friend NotInheritable Class CustomResourceReader Implements IResourceReader Private _resources As IDictionary Public Sub New(ByVal resources As IDictionary) _resources = resources End Sub Function GetEnumerator1() As IDictionaryEnumerator Implements IResourceReader.GetEnumerator Return _resources.GetEnumerator() End Function Sub Close() Implements IResourceReader.Close End Sub Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator Return _resources.GetEnumerator() End Function Sub Dispose() Implements IDisposable.Dispose End Sub End Class Public Class CustomDesignTimeResourceProviderFactory Inherits DesignTimeResourceProviderFactory Private _localResourceProvider As New CustomDesignTimeLocalResourceProvider Private _localResourceWriter As New CustomDesignTimeLocalResourceWriter Private _globalResourceProvider As New CustomDesignTimeGlobalResourceProvider Public Overrides Function CreateDesignTimeLocalResourceProvider(ByVal serviceProvider As IServiceProvider) As IResourceProvider ' Return an IResourceProvider. If (_localResourceProvider Is Nothing) Then _localResourceProvider = New CustomDesignTimeLocalResourceProvider End If Return _localResourceProvider End Function Public Overrides Function CreateDesignTimeLocalResourceWriter(ByVal serviceProvider As IServiceProvider) As IDesignTimeResourceWriter ' Return an IDesignTimeResourceWriter. If (_localResourceWriter Is Nothing) Then _localResourceWriter = New CustomDesignTimeLocalResourceWriter End If Return _localResourceWriter End Function Public Overrides Function CreateDesignTimeGlobalResourceProvider(ByVal serviceProvider As IServiceProvider, ByVal classKey As String) As IResourceProvider ' Return an IResourceProvider. If (_globalResourceProvider Is Nothing) Then _globalResourceProvider = New CustomDesignTimeGlobalResourceProvider End If Return _globalResourceProvider End Function End Class
namespace CustomResourceProviders { using System; using System.Collections.Generic; using System.Text; using System.Web.Compilation; using System.Resources; using System.Globalization; using System.Collections; using System.Reflection; using System.Web.UI.Design; [ DesignTimeResourceProviderFactoryAttribute( typeof(CustomDesignTimeResourceProviderFactory)) ] public class CustomResourceProviderFactory : ResourceProviderFactory { public override IResourceProvider CreateGlobalResourceProvider(string classname) { return new CustomResourceProvider(null, classname); } public override IResourceProvider CreateLocalResourceProvider(string virtualPath) { return new CustomResourceProvider(virtualPath, null); } } // Define the resource provider for global and local resources. internal class CustomResourceProvider : IResourceProvider { string _virtualPath; string _className; public CustomResourceProvider(string virtualPath, string classname) { _virtualPath = virtualPath; _className = classname; } private IDictionary GetResourceCache(string culturename) { return (IDictionary) System.Web.HttpContext.Current.Cache[culturename]; } object IResourceProvider.GetObject (string resourceKey, CultureInfo culture) { object value; string cultureName = null; if (culture != null) { cultureName = culture.Name; } else { cultureName = CultureInfo.CurrentUICulture.Name; } value = GetResourceCache(cultureName)[resourceKey]; if (value == null) { value = GetResourceCache(null)[resourceKey]; } return value; } IResourceReader IResourceProvider.ResourceReader { get { string cultureName = null; CultureInfo currentUICulture = CultureInfo.CurrentUICulture; if (!String.Equals(currentUICulture.Name, CultureInfo.InstalledUICulture.Name)) { cultureName = currentUICulture.Name; } return new CustomResourceReader (GetResourceCache(cultureName)); } } } internal sealed class CustomResourceReader : IResourceReader { private IDictionary _resources; public CustomResourceReader(IDictionary resources) { _resources = resources; } IDictionaryEnumerator IResourceReader.GetEnumerator() { return _resources.GetEnumerator(); } void IResourceReader.Close() { } IEnumerator IEnumerable.GetEnumerator() { return _resources.GetEnumerator(); } void IDisposable.Dispose() { return; } } public class CustomDesignTimeResourceProviderFactory : DesignTimeResourceProviderFactory { private CustomDesignTimeLocalResourceProvider _localResourceProvider; private CustomDesignTimeLocalResourceWriter _localResourceWriter; private CustomDesignTimeGlobalResourceProvider _globalResourceProvider; public override IResourceProvider CreateDesignTimeLocalResourceProvider(IServiceProvider serviceProvider) { // Return an IResourceProvider. if (_localResourceProvider == null) { _localResourceProvider = new CustomDesignTimeLocalResourceProvider(); } return _localResourceProvider; } public override IDesignTimeResourceWriter CreateDesignTimeLocalResourceWriter(IServiceProvider serviceProvider) { // Return an IDesignTimeResourceWriter. if (_localResourceWriter == null) { _localResourceWriter = new CustomDesignTimeLocalResourceWriter(); } return _localResourceWriter; } public override IResourceProvider CreateDesignTimeGlobalResourceProvider(IServiceProvider serviceProvider , string classKey) { // Return an IResourceProvider. if (_globalResourceProvider == null) { _globalResourceProvider = new CustomDesignTimeGlobalResourceProvider(); } return _globalResourceProvider; } }


System.Attribute
System.Web.Compilation.DesignTimeResourceProviderFactoryAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignTimeResourceProviderFactoryAttribute コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)

Dim factoryTypeName As String Dim instance As New DesignTimeResourceProviderFactoryAttribute(factoryTypeName)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignTimeResourceProviderFactoryAttribute コンストラクタ

名前 | 説明 |
---|---|
DesignTimeResourceProviderFactoryAttribute (String) | 指定したファクトリ型の名前に設定された属性を使用して、DesignTimeResourceProviderFactoryAttribute クラスの新しいインスタンスを初期化します。 |
DesignTimeResourceProviderFactoryAttribute (Type) | 指定したファクトリ型の修飾名に設定された属性を使用して、DesignTimeResourceProviderFactoryAttribute クラスの新しいインスタンスを初期化します。 |

DesignTimeResourceProviderFactoryAttribute コンストラクタ (Type)
アセンブリ: System.Web (system.web.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DesignTimeResourceProviderFactoryAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | FactoryTypeName | ファクトリ型の名前の値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

DesignTimeResourceProviderFactoryAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 既定のプロバイダが使用されているかどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

DesignTimeResourceProviderFactoryAttribute メンバ
デザイン時のリソース プロバイダ ファクトリの型を指定します。このクラスは継承できません。
DesignTimeResourceProviderFactoryAttribute データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | DesignTimeResourceProviderFactoryAttribute | オーバーロードされます。 DesignTimeResourceProviderFactoryAttribute クラスの新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | FactoryTypeName | ファクトリ型の名前の値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 既定のプロバイダが使用されているかどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からDesignTimeResourceProviderFactoryAttributeを検索する場合は、下記のリンクをクリックしてください。

- DesignTimeResourceProviderFactoryAttributeのページへのリンク