ObjectDataSourceDesigner クラスとは? わかりやすく解説

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

ObjectDataSourceDesigner クラス

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

ObjectDataSource Web サーバー コントロールを、ビジュアル デザイナで、デザイン時に使用できるようにします。

名前空間: System.Web.UI.Design.WebControls
アセンブリ: System.Design (system.design.dll 内)
構文構文

Public Class ObjectDataSourceDesigner
    Inherits DataSourceDesigner
Dim instance As ObjectDataSourceDesigner
public class ObjectDataSourceDesigner : DataSourceDesigner
public ref class ObjectDataSourceDesigner :
 public DataSourceDesigner
public class ObjectDataSourceDesigner extends
 DataSourceDesigner
public class ObjectDataSourceDesigner extends
 DataSourceDesigner
解説解説

ObjectDataSource コントロールは、データベース削除挿入選択、および更新操作実行するためにビジネス オブジェクトメソッド呼び出すデータ ソース表します

ビジュアル デザイナソース ビューからデザイン ビュー切り替えると、ObjectDataSource コントロール記述するマークアップソース コード解析されコントロールデザインバージョンデザイン サーフェイス作成されます。元のソース ビュー切り替えると、デザインコントロールマークアップソース コード永続化され、Web ページマークアップ反映されます。ObjectDataSourceDesigner クラスは、ビジュアル デザイナObjectDataSource コントロールデザイン時に使用できるようにします。

ObjectDataSourceDesigner クラスメンバは、次の機能提供します

使用例使用例

ObjectDataSourceDesigner クラス拡張しObjectDataSource コントロールか派生したコントロール外観動作デザイン時に変更するコード例次に示します

この例では、MyObjectDataSource コントロールObjectDataSource から派生させています。MyObjectDataSource は、ObjectDataSource コントロールコピーです。この例では、さらに、ObjectDataSourceDesigner から MyObjectDataSourceDesigner クラス派生させ、MyObjectDataSource コントロールMyObjectDataSourceDesigner に DesignerAttribute 属性適用してます。

MyObjectDataSourceDesigner は、PreFilterProperties メソッドオーバーライドして、デザイン時に [プロパティ] グリッドNamingContainer プロパティ表示します

MyObjectDataSourceDesigner は、GetDesignTimeHtml メソッドオーバーライドして、コントロール種類および ID加えてTypeName プロパティおよび SelectMethod プロパティをプレースホルダに表示します

Imports System
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions

Namespace Examples.VB.WebControls.Design

    ' The MyObjectDataSource is a copy of the ObjectDataSource.
    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <Designer(GetType(Examples.VB.WebControls.Design. _
        MyObjectDataSourceDesigner))> _
    Public Class MyObjectDataSource
        Inherits ObjectDataSource
    End Class ' MyObjectDataSource

    ' Derive a designer that inherits from the ObjectDataSourceDesigner.
    <ReflectionPermission(SecurityAction.Demand, Flags:=ReflectionPermissionFlag.MemberAccess)>
 _
    Public Class MyObjectDataSourceDesigner
        Inherits ObjectDataSourceDesigner

        ' Generate the design-time markup.
        Public Overrides Function
 GetDesignTimeHtml() As String

            ' Get a reference to the control or a copy of the control.
            Dim myODS As MyObjectDataSource
 = _
                CType(ViewControl, MyObjectDataSource)

            Dim markup As String
 = _
                CreatePlaceHolderDesignTimeHtml( _
                    "<b>TypeName</b> """
 & myODS.TypeName & """<br
 />" & _
                    "<b>SelectMethod</b> """
 & myODS.SelectMethod & """")

            Return markup

        End Function ' GetDesignTimeHtml

        ' Shadow the control properties with design-time properties.
        Protected Overrides Sub
 PreFilterProperties( _
            ByVal properties As IDictionary)

            ' Call the base method first.
            MyBase.PreFilterProperties(properties)

            ' Make the NamingContainer visible in the Properties grid.
            Dim selectProp As PropertyDescriptor
 = _
                CType(properties("NamingContainer"),
 PropertyDescriptor)
            properties("NamingContainer") = _
                TypeDescriptor.CreateProperty(selectProp.ComponentType, _
                    selectProp, BrowsableAttribute.Yes)
        End Sub ' PreFilterProperties

    End Class ' MyObjectDataSourceDesigner
End Namespace ' Examples.VB.WebControls.Design
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;

namespace Examples.CS.WebControls.Design
{
    // The MyObjectDataSource is a copy of the ObjectDataSource.
    [AspNetHostingPermission(SecurityAction.Demand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(Examples.CS.WebControls.Design.
        MyObjectDataSourceDesigner))]
    public class MyObjectDataSource : ObjectDataSource
    {
    } // MyObjectDataSource

    // Derive a designer that inherits from the ObjectDataSourceDesigner.
    [ReflectionPermission(SecurityAction.Demand, Flags=ReflectionPermissionFlag.MemberAccess)]
    public class MyObjectDataSourceDesigner
 : ObjectDataSourceDesigner
    {
        // Generate the design-time markup.
        public override string GetDesignTimeHtml()
        {
            // Get a reference to the control or a copy of the control.
            MyObjectDataSource myODS = (MyObjectDataSource)ViewControl;

            // Create a placeholder that displays the type of the business
 
            // object and the name of the Select method.
            string markup = CreatePlaceHolderDesignTimeHtml(
                 "<b>TypeName</b> \"" + myODS.TypeName
 + "\"<br />" + 
                 "<b>SelectMethod</b> \"" + myODS.SelectMethod
 + "\"" );

            return markup;

        } // GetDesignTimeHtml

        // Shadow the control properties with design-time properties.
        protected override void PreFilterProperties(IDictionary
 properties)
        {
            // Call the base method first.
            base.PreFilterProperties(properties);

            // Make the NamingContainer visible in the Properties grid.
            PropertyDescriptor selectProp =
                (PropertyDescriptor)properties["NamingContainer"];
            properties["NamingContainer"] =
                TypeDescriptor.CreateProperty(selectProp.ComponentType,
                    selectProp, BrowsableAttribute.Yes);
        } // PreFilterProperties

    } // MyObjectDataSourceDesigner
} // Examples.CS.WebControls.Design
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.ComponentModel.Design.ComponentDesigner
     System.Web.UI.Design.HtmlControlDesigner
       System.Web.UI.Design.ControlDesigner
         System.Web.UI.Design.DataSourceDesigner
          System.Web.UI.Design.WebControls.ObjectDataSourceDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「ObjectDataSourceDesigner クラス」の関連用語

ObjectDataSourceDesigner クラスのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS