DesignTimeResourceProviderFactoryAttributeとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DesignTimeResourceProviderFactoryAttributeの意味・解説 

DesignTimeResourceProviderFactoryAttribute クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

デザイン時のリソース プロバイダ ファクトリの型を指定します。このクラス継承できません。

名前空間: System.Web.Compilation
アセンブリ: System.Web (system.web.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class
 DesignTimeResourceProviderFactoryAttribute
    Inherits Attribute
Dim instance As DesignTimeResourceProviderFactoryAttribute
[AttributeUsageAttribute(AttributeTargets.Class)] 
public sealed class DesignTimeResourceProviderFactoryAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] 
public ref class DesignTimeResourceProviderFactoryAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
public final class DesignTimeResourceProviderFactoryAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class) 
public final class DesignTimeResourceProviderFactoryAttribute
 extends 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;
        }
    }
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.Compilation.DesignTimeResourceProviderFactoryAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DesignTimeResourceProviderFactoryAttribute メンバ
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute

DesignTimeResourceProviderFactoryAttribute コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したファクトリ型の名前に設定され属性使用して、DesignTimeResourceProviderFactoryAttribute クラス新しインスタンス初期化します。

名前空間: System.Web.Compilation
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    factoryTypeName As String _
)
Dim factoryTypeName As String

Dim instance As New DesignTimeResourceProviderFactoryAttribute(factoryTypeName)
public DesignTimeResourceProviderFactoryAttribute (
    string factoryTypeName
)
public:
DesignTimeResourceProviderFactoryAttribute (
    String^ factoryTypeName
)
public DesignTimeResourceProviderFactoryAttribute (
    String factoryTypeName
)
public function DesignTimeResourceProviderFactoryAttribute
 (
    factoryTypeName : String
)

パラメータ

factoryTypeName

リソース プロバイダのファクトリ型の名前。

解説解説

DesignTimeResourceProviderFactoryAttribute 属性factoryTypeName設定されています。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DesignTimeResourceProviderFactoryAttribute クラス
DesignTimeResourceProviderFactoryAttribute メンバ
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute

DesignTimeResourceProviderFactoryAttribute コンストラクタ

DesignTimeResourceProviderFactoryAttribute クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

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

関連項目

DesignTimeResourceProviderFactoryAttribute クラス
DesignTimeResourceProviderFactoryAttribute メンバ
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute

DesignTimeResourceProviderFactoryAttribute コンストラクタ (Type)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したファクトリ型の修飾名に設定され属性使用して、DesignTimeResourceProviderFactoryAttribute クラス新しインスタンス初期化します。

名前空間: System.Web.Compilation
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    factoryType As Type _
)
Dim factoryType As Type

Dim instance As New DesignTimeResourceProviderFactoryAttribute(factoryType)
public DesignTimeResourceProviderFactoryAttribute (
    Type factoryType
)
public:
DesignTimeResourceProviderFactoryAttribute (
    Type^ factoryType
)
public DesignTimeResourceProviderFactoryAttribute (
    Type factoryType
)
public function DesignTimeResourceProviderFactoryAttribute
 (
    factoryType : Type
)

パラメータ

factoryType

リソース プロバイダのファクトリ型。

解説解説

FactoryTypeName プロパティは、factoryType パラメータの AssemblyQualifiedName プロパティ値に設定されます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DesignTimeResourceProviderFactoryAttribute クラス
DesignTimeResourceProviderFactoryAttribute メンバ
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute

DesignTimeResourceProviderFactoryAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ FactoryTypeName ファクトリ型の名前の値を取得します
パブリック プロパティ TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。 ( Attribute から継承されます。)
参照参照

関連項目

DesignTimeResourceProviderFactoryAttribute クラス
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DesignTimeResourceProviderFactoryAttribute クラス
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute

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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DesignTimeResourceProviderFactoryAttribute クラス
System.Web.Compilation 名前空間
ResourceProviderFactory
DesignTimeResourceProviderFactory
Attribute


このページでは「.NET Framework クラス ライブラリ リファレンス」からDesignTimeResourceProviderFactoryAttributeを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDesignTimeResourceProviderFactoryAttributeを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDesignTimeResourceProviderFactoryAttribute を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DesignTimeResourceProviderFactoryAttribute」の関連用語

DesignTimeResourceProviderFactoryAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DesignTimeResourceProviderFactoryAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS