Hi
I have a Betfair BOT that once every few seconds or so grabs the prices of all runners in all markets (UK,IRE,FRA etc) and then saves them to the DB.
However as the stored proc that is called does quite a bit of work including looking for possible trades and moves in the market I want to be able to "fire and forget" e.g not wait for the response of the stored proc before moving onto the next record as that slows things down and I need to be moving quickly.
What is the best method of calling a stored proc in C# and NOT waiting for the result, returning a success status, and then moving onto the next record.
I'd like to be able to just quickly loop through my object list of selections and call some method that does the DB call without waiting for the response before moving to the next item in the loop.
It's a windows service running from my PC at the moment in C# 4.5. The calls to collect prices are fired from timers that wait X seconds before running the relevant code to collect the API data from Betfair and get their current prices etc.
I was thinking about using something like
Parallel.ForEach(sqlRecordset.AsEnumerable(), recordsetRow =>
{
// get data for selection
// call DB to save without waiting for response / success/failure status
}
But I don't know if this is the best approach or not.
Ideas?
Thanks in advance for any help.
I have a Betfair BOT that once every few seconds or so grabs the prices of all runners in all markets (UK,IRE,FRA etc) and then saves them to the DB.
However as the stored proc that is called does quite a bit of work including looking for possible trades and moves in the market I want to be able to "fire and forget" e.g not wait for the response of the stored proc before moving onto the next record as that slows things down and I need to be moving quickly.
What is the best method of calling a stored proc in C# and NOT waiting for the result, returning a success status, and then moving onto the next record.
I'd like to be able to just quickly loop through my object list of selections and call some method that does the DB call without waiting for the response before moving to the next item in the loop.
It's a windows service running from my PC at the moment in C# 4.5. The calls to collect prices are fired from timers that wait X seconds before running the relevant code to collect the API data from Betfair and get their current prices etc.
I was thinking about using something like
Parallel.ForEach(sqlRecordset.AsEnumerable(), recordsetRow =>
{
// get data for selection
// call DB to save without waiting for response / success/failure status
}
But I don't know if this is the best approach or not.
Ideas?
Thanks in advance for any help.


Comment