DataObjectAttribute クラス
アセンブリ: System (system.dll 内)
構文<AttributeUsageAttribute(AttributeTargets.Class)> _ Public NotInheritable Class DataObjectAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)] public sealed class DataObjectAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] public ref class DataObjectAttribute sealed : public Attribute
解説DataObjectAttribute 属性を使用して、あるオブジェクトを、ObjectDataSource オブジェクトでの使用に適したオブジェクトとして識別します。ObjectDataSourceDesigner クラスなどのデザイン時のクラスは、DataObjectAttribute 属性を使用して、ObjectDataSource オブジェクトへのバインドに適したオブジェクトを表します。
使用例DataObjectAttribute 属性を適用して、オブジェクトが ObjectDataSource オブジェクトへのバインドに適しているかどうかを示す方法を次のコード例に示します。この例で、NorthwindData オブジェクトは、ObjectDataSource オブジェクトと共に使用することを目的としています。
<DataObjectAttribute()> _ Public Class NorthwindData <DataObjectMethodAttribute(DataObjectMethodType.Select, True)> _ Public Shared Function GetAllEmployees() As IEnumerable Dim ads As New AccessDataSource() ads.DataSourceMode = SqlDataSourceMode.DataReader ads.DataFile = "~/App_Data/Northwind.mdb" ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees" Return ads.Select(DataSourceSelectArguments.Empty) End Function 'GetAllEmployees ' Delete the Employee by ID. <DataObjectMethodAttribute(DataObjectMethodType.Delete, True)> _ Public Sub DeleteEmployeeByID(ByVal employeeID As Integer) Throw New Exception("The value passed to the delete method is " + employeeID.ToString()) End Sub 'DeleteEmployeeByID End Class 'NorthwindData
[DataObjectAttribute] public class NorthwindData { public NorthwindData() {} [DataObjectMethodAttribute(DataObjectMethodType.Select, true)] public static IEnumerable GetAllEmployees() { AccessDataSource ads = new AccessDataSource(); ads.DataSourceMode = SqlDataSourceMode.DataReader; ads.DataFile = "~//App_Data//Northwind.mdb"; ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees"; return ads.Select(DataSourceSelectArguments.Empty); } // Delete the Employee by ID. [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)] public void DeleteEmployeeByID(int employeeID) { throw new Exception("The value passed to the delete method is " + employeeID.ToString()); } }
継承階層System.Attribute
System.ComponentModel.DataObjectAttribute
スレッド セーフ
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataObjectAttribute コンストラクタ ()
アセンブリ: System (system.dll 内)
構文
解説
使用例DataObjectAttribute コンストラクタを使用するコード例を次に示します。
<DataObjectAttribute()> _ Public Class NorthwindData <DataObjectMethodAttribute(DataObjectMethodType.Select, True)> _ Public Shared Function GetAllEmployees() As IEnumerable Dim ads As New AccessDataSource() ads.DataSourceMode = SqlDataSourceMode.DataReader ads.DataFile = "~/App_Data/Northwind.mdb" ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees" Return ads.Select(DataSourceSelectArguments.Empty) End Function 'GetAllEmployees ' Delete the Employee by ID. <DataObjectMethodAttribute(DataObjectMethodType.Delete, True)> _ Public Sub DeleteEmployeeByID(ByVal employeeID As Integer) Throw New Exception("The value passed to the delete method is " + employeeID.ToString()) End Sub 'DeleteEmployeeByID End Class 'NorthwindData
[DataObjectAttribute] public class NorthwindData { public NorthwindData() {} [DataObjectMethodAttribute(DataObjectMethodType.Select, true)] public static IEnumerable GetAllEmployees() { AccessDataSource ads = new AccessDataSource(); ads.DataSourceMode = SqlDataSourceMode.DataReader; ads.DataFile = "~//App_Data//Northwind.mdb"; ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees"; return ads.Select(DataSourceSelectArguments.Empty); } // Delete the Employee by ID. [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)] public void DeleteEmployeeByID(int employeeID) { throw new Exception("The value passed to the delete method is " + employeeID.ToString()); } }
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataObjectAttribute コンストラクタ (Boolean)
アセンブリ: System (system.dll 内)
構文
解説DataObjectAttribute(Boolean) コンストラクタを使用して、ObjectDataSourceDesigner クラスなどのデザイン時クラスに対して、あるオブジェクトを ObjectDataSource オブジェクトへのバインドに適したオブジェクトの一覧から除外する必要があることを示します。
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataObjectAttribute コンストラクタ
オーバーロードの一覧| 名前 | 説明 |
|---|---|
| DataObjectAttribute () | DataObjectAttribute クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
| DataObjectAttribute (Boolean) | DataObjectAttribute クラスの新しいインスタンスを初期化し、オブジェクトが ObjectDataSource オブジェクトへのバインドに適しているかどうかを示します。 .NET Compact Framework によってサポートされています。 |
参照DataObjectAttribute フィールド
DataObjectAttribute プロパティ
DataObjectAttribute メソッド
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 2 つの DataObjectAttribute インスタンスが等しいかどうかを判断します。 |
| GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
| GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
| GetHashCode | オーバーライドされます。 |
| GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
| IsDefaultAttribute | オーバーライドされます。 属性の現在の値が既定値かどうかを示す値を取得します。 |
| IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
| Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
参照DataObjectAttribute メンバ
ある型を、ObjectDataSource オブジェクトへのバインドに適したオブジェクトとして識別します。このクラスは継承できません。
DataObjectAttribute データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック フィールド
パブリック プロパティ
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 2 つの DataObjectAttribute インスタンスが等しいかどうかを判断します。 |
| GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
| GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
| GetHashCode | オーバーライドされます。 |
| GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
| IsDefaultAttribute | オーバーライドされます。 属性の現在の値が既定値かどうかを示す値を取得します。 |
| IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
| Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
参照- DataObjectAttributeのページへのリンク