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

ConstructionEnabledAttribute クラス

COM+ オブジェクト構築できるようにします。このクラス継承できません。

名前空間: System.EnterpriseServices
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class, Inherited:=True)> _
<ComVisibleAttribute(False)> _
Public NotInheritable Class
 ConstructionEnabledAttribute
    Inherits Attribute
Dim instance As ConstructionEnabledAttribute
[AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)]
 
[ComVisibleAttribute(false)] 
public sealed class ConstructionEnabledAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, Inherited=true)]
 
[ComVisibleAttribute(false)] 
public ref class ConstructionEnabledAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)
 */ 
/** @attribute ComVisibleAttribute(false) */ 
public final class ConstructionEnabledAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)
 
ComVisibleAttribute(false) 
public final class ConstructionEnabledAttribute
 extends Attribute
解説解説
使用例使用例

この属性使用してオブジェクト コンストラクタ文字列を ServicedComponent クラス関連付ける方法コード例次に示します

' Accept a constructor string.
<ConstructionEnabled()>  _
Public Class EmployeeInformation
    
    Inherits ServicedComponent
    
    ' The employee's user name and salary.
    Private accountName As String
    Private salary As Double
 = 0
    
    ' Get the employee's name. All users can call this method.
    Public Function GetName() As
 String 
        Return accountName
    
    End Function 'GetName
    
    ' Set the employee's salary. Only managers can do this.
    Public Sub SetSalary(ByVal
 ammount As Double) 
        If SecurityCallContext.CurrentCall.IsCallerInRole("Manager")
 Then
            salary = ammount
        Else
            Throw New UnauthorizedAccessException()
        End If
    
    End Sub 'SetSalary
    
    ' Get the employee's salary. Only the employee and managers can
 do this.
    Public Function GetSalary() As
 Double 
        If SecurityCallContext.CurrentCall.DirectCaller.AccountName
 = accountName OrElse SecurityCallContext.CurrentCall.IsCallerInRole("Manager")
 Then
            Return salary
        Else
            Throw New UnauthorizedAccessException()
        End If
    
    End Function 'GetSalary
    
    ' Use the constructor string.
    ' This method is called when the object is instantiated.
    Protected Overrides Sub
 Construct(ByVal constructorString As String)
 
        accountName = constructorString
    
    End Sub 'Construct

End Class 'EmployeeInformation
// Accept a constructor string.
[ConstructionEnabled]

public class EmployeeInformation : ServicedComponent
{

    // The employee's user name and salary.
    private string accountName;
    private double salary = 0;

  
    // Get the employee's name. All users can call this method.
    public string GetName ()
    {
      return(accountName);
    }


    // Set the employee's salary. Only managers can do this.
    public void SetSalary (double ammount)
    {
        if (SecurityCallContext.CurrentCall.IsCallerInRole("Manager"))
        {
            salary = ammount;
        }
        else
        {
            throw new UnauthorizedAccessException();
        }
    }


    // Get the employee's salary. Only the employee and managers can
 do this.
    public double GetSalary ()
    {
        if ( SecurityCallContext.CurrentCall.DirectCaller.AccountName
 == accountName ||
             SecurityCallContext.CurrentCall.IsCallerInRole("Manager")
 )
        {
            return(salary);
        }
        else
        {
          throw new UnauthorizedAccessException();
        }
    }


    // Use the constructor string.
    // This method is called when the object is instantiated.
    protected override void Construct (string
 constructorString)
    {
        accountName = constructorString;
    }

}
// Accept a constructor string.

[ConstructionEnabled]
public ref class EmployeeInformation: public
 ServicedComponent
{
private:

   // The employee's user name and salary.
   String^ accountName;
   double salary;

public:

   // Get the employee's name. All users can call this method.
   String^ GetName()
   {
      return (accountName);
   }

   // Set the employee's salary. Only managers can do this.
   void SetSalary( double ammount )
   {
      if ( SecurityCallContext::CurrentCall->IsCallerInRole(
 "Manager" ) )
      {
         salary = ammount;
      }
      else
      {
         throw gcnew UnauthorizedAccessException;
      }
   }

   // Get the employee's salary. Only the employee and managers can
 do this.
   double GetSalary()
   {
      if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName
 == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager"
 ) )
      {
         return (salary);
      }
      else
      {
         throw gcnew UnauthorizedAccessException;
      }
   }

protected:
   // Use the constructor string.
   // This method is called when the object is instantiated.
   virtual void Construct( String^ constructorString ) override
   {
      accountName = constructorString;
   }
};

// Accept a constructor string.
/** @attribute ConstructionEnabled()
 */
public class EmployeeInformation extends ServicedComponent
{
    // The employee's user name and salary.
    private String accountName;
    private double salary = 0;

    // Get the employee's name. All users can call this method.
    public String GetName()
    {
        return accountName;
    } //GetName

    // Set the employee's salary. Only managers can do this.
    public void SetSalary(double ammount) 
        throws System.UnauthorizedAccessException
    {
        if (SecurityCallContext.get_CurrentCall().IsCallerInRole("Manager"))
 {
            salary = ammount;
        }
        else {
            throw new UnauthorizedAccessException();
        }
    } //SetSalary

    // Get the employee's salary. Only the employee and managers can
 do this.
    public double GetSalary() throws System.UnauthorizedAccessException
    {
        if (SecurityCallContext.get_CurrentCall().get_DirectCaller().
            get_AccountName().Equals(accountName) 
            || SecurityCallContext.get_CurrentCall().
            IsCallerInRole("Manager")) {
            return salary;
        }
        else {
            throw new UnauthorizedAccessException();
        }
    } //GetSalary

    // Use the constructor string.
    // This method is called when the object is instantiated.
    protected void Construct(String constructorString)
    {
        accountName = constructorString;
    } //Construct
} //EmployeeInformation
継承階層継承階層
System.Object
   System.Attribute
    System.EnterpriseServices.ConstructionEnabledAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ConstructionEnabledAttribute コンストラクタ ()

ConstructionEnabledAttribute クラス新しインスタンス初期化しEnabled および Default既定設定初期化します。

名前空間: System.EnterpriseServices
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

Dim instance As New ConstructionEnabledAttribute
public ConstructionEnabledAttribute ()
public:
ConstructionEnabledAttribute ()
public ConstructionEnabledAttribute ()
public function ConstructionEnabledAttribute
 ()
解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConstructionEnabledAttribute クラス
ConstructionEnabledAttribute メンバ
System.EnterpriseServices 名前空間

ConstructionEnabledAttribute コンストラクタ (Boolean)

ConstructionEnabledAttribute クラス新しインスタンス初期化しEnabled指定された値に設定します

名前空間: System.EnterpriseServices
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

Dim val As Boolean

Dim instance As New ConstructionEnabledAttribute(val)
public ConstructionEnabledAttribute (
    bool val
)
public:
ConstructionEnabledAttribute (
    bool val
)
public ConstructionEnabledAttribute (
    boolean val
)
public function ConstructionEnabledAttribute
 (
    val : boolean
)

パラメータ

val

COM+ オブジェクト構築できる場合trueそれ以外場合false

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConstructionEnabledAttribute クラス
ConstructionEnabledAttribute メンバ
System.EnterpriseServices 名前空間

ConstructionEnabledAttribute コンストラクタ

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

名前 説明
ConstructionEnabledAttribute () ConstructionEnabledAttribute クラス新しインスタンス初期化しEnabled および Default既定設定初期化します。
ConstructionEnabledAttribute (Boolean) ConstructionEnabledAttribute クラス新しインスタンス初期化しEnabled指定された値に設定します
参照参照

関連項目

ConstructionEnabledAttribute クラス
ConstructionEnabledAttribute メンバ
System.EnterpriseServices 名前空間

ConstructionEnabledAttribute プロパティ


ConstructionEnabledAttribute メソッド


パブリック メソッドパブリック メソッド

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

関連項目

ConstructionEnabledAttribute クラス
System.EnterpriseServices 名前空間

ConstructionEnabledAttribute メンバ

COM+ オブジェクト構築できるようにします。このクラス継承できません。

ConstructionEnabledAttribute データ型公開されるメンバを以下の表に示します


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

関連項目

ConstructionEnabledAttribute クラス
System.EnterpriseServices 名前空間


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

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

辞書ショートカット

すべての辞書の索引

「ConstructionEnabledAttribute」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS