Wow, that was a quick solution, wayne! Thanks for your input.
In reviewing my options, I've decided to go with the following approach below, but first, a bit more detail on the problem so the approach makes sense in the context of a real problem.
I have an "Assignment" table, which has a column "bmkTableState". I had named it "bmkEntityState" but it turns out that LLBLGen already has an enum by that name. (Thanks for hogging all the good terms, Frans
.) The "bmkTableState" column will change when the user (person who the Assignment is assigned to) says the state of the Assignment has changed (e.g. from Assigned to Completed).
So here's how I'll handle sending notifications:
- Put a trigger on Assignment table
if updated (bmkTableState)
begin
insert TransitionQueue
(
bmkOldTableState,
bmkNewTableState,
TableName,
bmkTableRecord
)
select
d.bmkTableState,
i.bmkTableState,
'Assignment',
bmkAssignment
from inserted i
inner join deleted d
on i.bmkAssignment = d.bmkAssignment
end
-
Create a new module in my already existing Windows Service
-
Poll the database at specified interval to look for new TransitionQueue's (using LLBLGen business objects, of course)
- Create a TransitionHandlerFactory that based on the TransitionQueue.TableName creates an ITransitionHandler of the correct type (concrete class for every table that handles state transitions)
- AssignmentTransitionHandler would process the record that was saved, and send a notification to the correct person (whoever the Assignment is now assigned to)
That's kind of a rough sketch too, but the basic idea is there.
I am interested in the forthcoming "Windows Workflow Foundation" and State Machines in general as a means to solve this problem, but I need something now.
Thanks again for your help wayne and Doug.