How to send SQL query only once and protect for duplicates with Worker service
Because you are using a worker and running async operation, I would not recommend to mix conditions that will complicate the already cumbersome debugging process.
I would add a column to your table as bit and use it as a flag column called IsSent
and then your query would look like:
select...... where name = X and IsSent = Y ...."
this way you will get only rows that are not sent. you can otherwise query the row in the code and check if the ID was sent.
cleaner, better, easier.
Make your code maintainable.