Resolve Concelier/Excititor merge conflicts
This commit is contained in:
54
Mongo2Go-4.1.0/src/Mongo2Go/MongoDbRunner.IDisposable.cs
Normal file
54
Mongo2Go-4.1.0/src/Mongo2Go/MongoDbRunner.IDisposable.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
namespace Mongo2Go
|
||||
{
|
||||
// IDisposable and friends
|
||||
public partial class MongoDbRunner
|
||||
{
|
||||
~MongoDbRunner()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (Disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (State != State.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
// we have no "managed resources" - but we leave this switch to avoid an FxCop CA1801 warnig
|
||||
}
|
||||
|
||||
if (_mongoDbProcess != null)
|
||||
{
|
||||
_mongoDbProcess.Dispose();
|
||||
}
|
||||
|
||||
// will be null if we are working in debugging mode (single instance)
|
||||
if (_dataDirectoryWithPort != null)
|
||||
{
|
||||
// finally clean up the data directory we created previously
|
||||
_fileSystem.DeleteFolder(_dataDirectoryWithPort);
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
State = State.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user