Database Updater Client

This section explains how to implement the Example Entry/Exit Recipes in a database updater client.

The following screenshot shows what you get when the database updater client is running.

The database client requires an SQL Server database to connect to. It creates a table called RecipeTags, which keeps track of the relation between recipes (identified by their pair of identifiers) and tags.

By opening the Server Explorer window in Visual Studio, you can view the contents of the RecipeTags table.

The code for this example shows how to minimize the changes made to the database if the connection is broken and then recovered. When a session is broken (for example when the TCP connection is lost), the whole state is sent from the reader to the client. In such cases, do not delete everything from the table at session start, and then build up the session state again; if there are triggers on the database table, this could cause spurious events.

The following example shows how to deal with the session start dump by pulling out a cache of the initial database state, and then calculating and enacting a minimal set of changes to make to the table at session start time.