public IEnumerable<WorkerRecord> GetWorkers(string applicationName, string machineAddress, string machineName, IDbTransaction transaction)
{
const string Sql =
@"SELECT *
FROM [BlueCollarWorker]
WHERE
[ApplicationName] = @ApplicationName
AND ([MachineName] IS NULL OR [MachineName] = '' OR [MachineName] = @MachineName)
AND ([MachineAddress] IS NULL OR [MachineAddress] = '' OR [MachineAddress] = @MachineAddress);";
return this.connection.Query<WorkerRecord>(
Sql,
new { ApplicationName = applicationName, MachineName = machineName, MachineAddress = machineAddress },
transaction,
true,
null,
null);
}