Currently, I am writing a MiddleWare application that synchronizes information between and accounting application (i.e. Quickbooks) and a SQL database. I am fairly new to Linq-To-SQL and am currently struggling with what originally appeared to be a simple problem.
In short, I have logic that queries the chart of accounts from the accounting application (i.e. AR, Income, Expense, Liability, etc…). Then, my Middleware has to determine whether or not it needs to insert, update, or delete an account in the Accounts table of the SQL database for each record. Figuring out whether or not the operation is insert or delete was pretty easy to figure out but, I am struggling with the case where an account is deleted from Quickbooks and needs to be deleted from my SQL database. I’d like to run a Linq-To-Sql query that basically deletes all records from the Account table where the ListID is not in the list of ListIDs retrieved from a query. Is there some easy way to perform this in Linq-To-Sql?
1 Answer