- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am developing a plugin that communicates with an ASP.NET WebApi to track the presence and position of certain block references within a drawing, and persists that data to a MySQL database in the cloud. The issue I have been trying to solve for weeks now is exactly when to fire the requests to the WebApi and persist the data to the MySQL database. Consider the following two scenarios to understand my dilemma.
- User places/moves/deletes a block reference into the current drawing. The user does not manually save the drawing and no autosave event occurs, but they click the "X" of the AutoCAD window to close the program. The "Would you like to save your pending changes?" dialog shows and they click "No".
- User places/moves/deletes a block reference into the current drawing. The user does not manually save the drawing and no autosave event occurs. Some error occurs that crashes AutoCAD. The user restarts AutoCAD but does not retrieve the backup drawing file and decides to use the version of the drawing that does not have the block that they just placed.
In both of these scenarios the block reference that I would like to track was inserted into/modified/deleted from the drawing, and then the user makes some choices that result in the current version of the drawing file not matching the list of changes that have been previously created by the user's actions in the drawing.
I have gone through multiple different strategies to attempt to cover my bases when tracking these block references, including the following.
- Send a request to the server whenever the block is inserted into/modified/deleted from the drawing, regardless of file save events.
- Create a queue for staged changes whenever blocks are added/modified/deleted, then send requests to the server when the drawing is saved (only event available was Database.SaveComplete which doesn't help with the dropping of pending changes)
- Subscribe to the Database events like ObjectAppended, ObjectModified, ObjectErased and send requests to the server when triggered.
No matter what I keep thinking of scenarios where the data in the drawing file can become different than the data in the cloud database. I am wondering if anyone here has done similar work with maintaining a cloud database that tracks the data within the user's local drawing files? Any suggestions are greatly appreciated. Maybe I just have to resign to developing a "sync" operation and indicator that tells the user the data between the server and the drawing don't match and have them choose to synchronize them?
Solved! Go to Solution.