HOME DOCUMENTATION DOWNLOADS

Enable model reloading when files change

Add an option to appsettings.json to reload model by the server when model files on the disc change.

I tested on my model . I changed caption of one field in model with architect. After that server threw an exception:

An unhandled exception occurred while processing the request.

Exception: An error has occured during automatic model reload. Please restart the server.
One or more errors occurred. (Could not find containing package for: F:\OrigamProjects\DockerTest\dockertest\DataEntity\dockertest\PhoneBook.origam)
at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
at System.Linq.Parallel.AsynchronousChannelMergeEnumerator`1.MoveNextSlowPath()
at System.Linq.Parallel.AsynchronousChannelMergeEnumerator`1.MoveNext()
at System.Linq.Parallel.QueryOpeningEnumerator`1.MoveNext()
at MoreLinq.MoreEnumerable.ForEach[T](IEnumerable`1 source, Action`1 action)
at Origam.DA.Service.OrigamXmlLoader.AddOrigamFiles(ItemTracker itemTracker, List`1 filesToLoad) in F:\gitave\origam-source\Origam.DA.Service\OrigamFile\XmlLoading\OrigamXmlLoader.cs:line 72
at Origam.DA.Service.OrigamXmlLoader.LoadInto(ItemTracker itemTracker, MetaModelUpgradeMode mode) in F:\gitave\origam-source\Origam.DA.Service\OrigamFile\XmlLoading\OrigamXmlLoader.cs:line 64
at Origam.DA.Service.FilePersistenceIndex.<>c__DisplayClass17_0.<ReloadFiles>b__0() in F:\gitave\origam-source\Origam.DA.Service\FilePersistenceIndex.cs:line 91
at Origam.Extensions.ReaderWriterLockSlimExtensions.RunWriter[T](ReaderWriterLockSlim rwLock, Func`1 func) in F:\gitave\origam-source\Origam.Common\Extensions\ReaderWriterLockSlimExtensions.cs:line 48
at Origam.DA.Service.FilePersistenceIndex.ReloadFiles(TrackerLoaderFactory trackerLoaderFactory) in F:\gitave\origam-source\Origam.DA.Service\FilePersistenceIndex.cs:line 83
at Origam.DA.Service.FilePersistenceProvider.ReloadFiles() in F:\gitave\origam-source\Origam.DA.Service\FilePersistenceProvider.cs:line 441
at Origam.Workbench.Services.FilePersistenceService.Reload() in F:\gitave\origam-source\Origam.Workbench.Services\FilePersistenceService.cs:line 175
at Origam.ServerCore.OrigamUtils.<>c__DisplayClass0_0.<ConnectOrigamRuntime>b__0(Object sender, FileSystemChangeEventArgs args) in F:\gitave\origam-source\Origam.ServerCore\OrigamUtils.cs:line 52

i did same change as before ,same result without errors.

So what was the result? What is the problem?

I have created a new branch “model-reload-debug” where I added the following logger calls:
Origam.ServerCore.OrigamUtils INFO
Origam.DA.Service.FileEventQueue DEBUG
Origam.DA.Service.FileChangesWatchDog DEBUG