Skip to main content

How to change the database structure

Zonal OCR uses a file-based SQL CE database stored on the user's computer to persist templates, fields, etc. If you need to make a change to the structure of the database (tables, columns, or whatever) follow these instructions.

Update the UpdateDbTool project
  • UpdateDbManager.cs
    • create an alter statement
    • create a query that determines if the database is at the new version
    • create a function that calls your alter statement(s)
    • add a version that that calls your previous function
  • This tool will update the user's database when they install the new version of Zonal. To test your changes, set UpdateDbTool as the startup project in Visual Studio and run it. Probably need to be in admin mode
Apply migration to the empty database
  • Update copy of ZonalOcrDb.sdf
Update the ZonalOCR project
  • DataAccess
    • ZonalOcrDb.edmx.sql - update initial creation queries
    • ZonalOcrDb.edmx
      • <edmx:StorageModels> -> <EntityType>
      • <edmx:ConceptualModels> -> <EntityType>
      • <EntitySetMapping>
    • Update models in /EntityModel/