DatabaseFactory に関連付けられたリクエスト スコープは、リクエストの完了後にデータベース接続を解放しますか?
kernel.Bind<IDatabaseFactory>().To<DatabaseFactory<MySqlConnection>>().InRequestScope().WithConstructorArgument("connectionString", Config.Data.MySQLConnection);
public class DatabaseFactory<T> : Disposable, IDatabaseFactory where T : IDbConnection, new()
{
private readonly string _connectionString;
private IDbConnection _dataConnection;
public DatabaseFactory(string connectionString)
{
_connectionString = connectionString;
}
#region IDatabaseFactory Members
public IDbConnection Get()
{
return _dataConnection ?? (_dataConnection = new T { ConnectionString = _connectionString });
}
#endregion
protected override void DisposeCore()
{
if (_dataConnection != null)
_dataConnection.Dispose();
}
}