Simplified object lifecycle verification.
This commit is contained in:
@@ -38,10 +38,7 @@ namespace NSspi.Credentials
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( base.GetType().Name );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.securityPackage;
|
return this.securityPackage;
|
||||||
}
|
}
|
||||||
@@ -56,10 +53,7 @@ namespace NSspi.Credentials
|
|||||||
string name = null;
|
string name = null;
|
||||||
bool gotRef = false;
|
bool gotRef = false;
|
||||||
|
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( "Credential" );
|
|
||||||
}
|
|
||||||
|
|
||||||
status = SecurityStatus.InternalError;
|
status = SecurityStatus.InternalError;
|
||||||
carrier = new QueryNameAttribCarrier();
|
carrier = new QueryNameAttribCarrier();
|
||||||
@@ -117,21 +111,15 @@ namespace NSspi.Credentials
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( "Credential" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.expiry;
|
return this.expiry;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected set
|
protected set
|
||||||
{
|
{
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( "Credential" );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.expiry = value;
|
this.expiry = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,20 +128,14 @@ namespace NSspi.Credentials
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( "Credential" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.safeCredHandle;
|
return this.safeCredHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected set
|
protected set
|
||||||
{
|
{
|
||||||
if( this.disposed )
|
CheckLifecycle();
|
||||||
{
|
|
||||||
throw new ObjectDisposedException( "Credential" );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.safeCredHandle = value;
|
this.safeCredHandle = value;
|
||||||
}
|
}
|
||||||
@@ -177,5 +159,13 @@ namespace NSspi.Credentials
|
|||||||
this.disposed = true;
|
this.disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckLifecycle()
|
||||||
|
{
|
||||||
|
if( this.disposed )
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException( "Credential" );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user