moding-il / bizdoc.core

Developer framework for designing organization forms
Other
2 stars 2 forks source link

Synchronizing database with form models #2

Open zehavibarak opened 3 years ago

zehavibarak commented 3 years ago

To synchronize tables mapped with Table, CubeMapping and ScheduleMapping call document factory synchronize method. Preferably by invoking it as Hangfire job on startup.cs.

RecurringJob.AddOrUpdate<DocumentFactory>(j => j.SyncronizeMappingAsync(), Cron.Never());

Trigger job manually from /hangfire/recurring and observe for any exception.

In addition to truncating form tables, this method truncates BizDoc.Cube and BizDoc.Entries tables. If your code adds records to BizDoc.Cube table from a 3rd party app, you should recreate these records.

zehavibarak commented 3 years ago

BizDoc now has an extension to add the above from startup.cs: BizDocApplicationBuilder.UseSynchronize(). Add the call after UseBizDoc() in Configure().