IDigitalFormDataModel.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. namespace InABox.Core
  3. {
  4. public delegate void DigitalFormUpdateHandler(IDigitalFormDataModel model);
  5. public delegate void DigitalFormBeforeUpdateHandler(IDigitalFormDataModel model);
  6. public interface IDigitalFormDataModel
  7. {
  8. public Entity Entity { get; set; }
  9. IDigitalFormInstance Instance { get; set; }
  10. public DigitalFormVariable[] Variables { get; set; }
  11. event DigitalFormUpdateHandler OnModelSaved;
  12. event DigitalFormBeforeUpdateHandler BeforeModelSaved;
  13. void Load(Action<IDigitalFormDataModel> callback);
  14. /// <summary>
  15. /// Saves the datamodel to the database, including the form instance and parent entity.
  16. /// </summary>
  17. /// <param name="callback">The callback to call once the update is finished, or <c>null</c> for synchronous execution.</param>
  18. void Update(Action<IDigitalFormDataModel>? callback);
  19. void DuplicateInstance();
  20. object? GetEntityValue(string name);
  21. void SetEntityValue(string name, object? value);
  22. }
  23. }