コンテキスト コンテナーが割り当てられている場合は削除します。
構文
virtual VOID ReleaseContainer(
VOID
) = 0;
パラメーター
このメソッドは、パラメーターを受け取りません。
スレッド セーフ
メソッドは ReleaseContainer 、分配される実装者にとってスレッド セーフではありません。
解説
このメソッドの動作は、実装によって異なります。 ガイドラインとして次の情報を使用する必要がありますが、すべてのシナリオで正しくない場合があります。
ほとんどの実装者は という名前のプライベート
Boolean値を宣言します。既定値は でfalse、既定の動作はdispensedにtrue設定dispensedされません。 ただし、 が呼び出されると、実装が にtrue設定dispensedされている場合、IDispensedHttpModuleContextContainer ポインターはそれ自体を呼び出しますdelete。ReleaseContainerそれ以外の場合、ReleaseContainerは空の操作です。が呼び出された場合
deleteは、IDispensedHttpModuleContextContainerIHttpStoredContext ポインターの内部配列を列挙し、 IHttpModuleContextContainer::SetModuleContext メソッドを使用して以前に追加されたすべてのポインターで IHttpStoredContext::CleanupStoredContext メソッドを呼び出します。 その後、コンテキスト コンテナーはヒープ上の配列メモリを破棄し、その配列を NULL に設定します。
例
次の例は、 インターフェイスを実装する という名前 MyContainer のカスタム クラスを IDispensedHttpModuleContextContainer 示しています。 また、 という名前のメソッドを実装する という名前MyClassGetModuleContextContainerのカスタム クラスも表示されます。 MyClass は、ポインターの MyContainer 有効期間中にポインターを MyClass 管理します。
// The MyContainer class implements the
// IDispensedHttpModuleContextContainer interface.
class MyContainer : public IDispensedHttpModuleContextContainer
{
public:
// The MyContainer method is the public
// constructor for the MyContainer class.
// Make this method protected if the
// MyContainer class is abstract.
// dispensed: true if the container should
// call delete this when the ReleaseContainer
// method is called.
MyContainer(bool dispensed = false)
: m_dispensed(dispensed)
{
}
// The ReleaseContainer method
// calls delete this if this container
// is dispensed.
virtual VOID ReleaseContainer(VOID)
{
if (m_dispensed)
{
delete this;
}
}
// Implement additional
// IDispensedHttpModuleContextContainer
// pure virtual methods if this class
// is not abstract.
private:
// The MyContainer method is the private
// destructor for the MyContainer class.
// Make this method protected and virtual
// if the MyContainer class expects
// to be a class of derivation. This method
// should not be public because
// IDispensedHttpModuleContextContainer pointers
// should be disposed externally only by
// calling the ReleaseContainer method.
~MyContainer()
{
}
// Specify a Boolean value for dispensing.
bool m_dispensed;
};
// Create the MyClass class.
class MyClass
{
public:
// The MyClass method is the public
// constructor for the MyClass class.
MyClass()
{
m_container = new MyContainer;
}
// The MyClass method is the
// public virtual destructor
// for the MyClass class. This destructor
// calls ReleaseContainer on the internal
// IDispensedHttpModuleContextContainer
// pointer and sets that pointer to NULL.
virtual ~MyClass()
{
m_container->ReleaseContainer();
m_container = NULL;
}
// The GetModuleContextContainer method
// returns an IHttpModuleContextContainer
// pointer.
// return: a static upcast
// IDispensedHttpModuleContextContainer.
virtual IHttpModuleContextContainer*
GetModuleContextContainer(VOID)
{
return static_cast<IHttpModuleContextContainer*>
(m_container);
}
// Implement additional IHttpUrlInfo
// pure virtual methods if this class
// is not abstract.
private:
// Specify a private
// IDispensedHttpModuleContextContainer
// pointer.
IDispensedHttpModuleContextContainer* m_container;
};
要件
| Type | 説明 |
|---|---|
| Client | - Windows Vista 上の IIS 7.0 - Windows 7 上の IIS 7.5 - Windows 8 の IIS 8.0 - Windows 10の IIS 10.0 |
| サーバー | - Windows Server 2008 の IIS 7.0 - Windows Server 2008 R2 上の IIS 7.5 - Windows Server 2012 上の IIS 8.0 - Windows Server 2012 R2 上の IIS 8.5 - Windows Server 2016上の IIS 10.0 |
| 製品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 - IIS Express 7.5、IIS Express 8.0、IIS Express 10.0 |
| Header | Httpserv.h |
参照
IDispensedHttpModuleContextContainer インターフェイス
IHttpApplication::GetModuleContextContainer メソッド
IHttpConnection::GetModuleContextContainer メソッド
IHttpContext::GetModuleContextContainer メソッド
IHttpFileInfo::GetModuleContextContainer メソッド
IHttpModuleContextContainer インターフェイス
IHttpSite::GetModuleContextContainer メソッド
IHttpUrlInfo::GetModuleContextContainer メソッド
IMetadataInfo::GetModuleContextContainer メソッド