ServiceCreatorCallback デリゲート
アセンブリ: System (system.dll 内)

<ComVisibleAttribute(True)> _ Public Delegate Function ServiceCreatorCallback ( _ container As IServiceContainer, _ serviceType As Type _ ) As Object
[ComVisibleAttribute(true)] public delegate Object ServiceCreatorCallback ( IServiceContainer container, Type serviceType )
[ComVisibleAttribute(true)] public delegate Object^ ServiceCreatorCallback ( IServiceContainer^ container, Type^ serviceType )
/** @delegate */ /** @attribute ComVisibleAttribute(true) */ public delegate Object ServiceCreatorCallback ( IServiceContainer container, Type serviceType )
戻り値
serviceType によって指定されたサービス。サービスが作成されなかった場合は null 参照 (Visual Basic では Nothing)。

ServiceCreatorCallback は、デザイナの読み込み直後に作成されるサービスではなく、必要に応じて作成を要求できるサービスを発行するための機構を提供します。サービスが必須ではなく、使用されない可能性がある場合は、コールバック関数を使用できます。ServiceCreatorCallback を使用して発行されたサービスは、要求および作成されない限り、リソースを消費することもありません。コールバック関数を使用してサービスを発行するには、ServiceCreatorCallback を IServiceContainer の AddService メソッドに渡します。
![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、SharedState です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

コールバック関数を使用してサービスを発行する方法を次のコード例で示します。
' The following code shows how to publish a service using a callback function. ' Creates a service creator callback. Dim callback1 As New ServiceCreatorCallback _ (AddressOf myCallBackMethod) ' Adds the service using its type and the service creator. serviceContainer.AddService(GetType(myService), callback1)
// The following code shows how to publish a service using a callback function. // Creates a service creator callback. ServiceCreatorCallback callback1 = new ServiceCreatorCallback(myCallBackMethod); // Adds the service using its type and the service creator callback. serviceContainer.AddService(typeof(myService), callback1);
// The following code shows how to publish a service using a callback function. // Creates a service creator callback. ServiceCreatorCallback^ callback1 = gcnew ServiceCreatorCallback( this, &Sample::myCallBackMethod ); // Adds the service using its type and the service creator callback. serviceContainer->AddService( myService::typeid, callback1 );
// The following code shows how to publish a service using a // callback function. // Creates a service creator callback. ServiceCreatorCallback callBack1 = new ServiceCreatorCallback( MyCallBackMethod); // Adds the service using its type and the service creator callback. serviceContainer.AddService(MyService.class.ToType(), callBack1);

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ServiceCreatorCallback デリゲートのページへのリンク