1. Michael Kramer
  2. SnapObjects
  3. Wednesday, 7 August 2019 04:19 AM UTC

I'm trying to make sense of SnapDevelop's generated code. Right now for Sample Code = ModelStore where one action puzzles me.

[HttpPost("ModelStore")]
...
public ActionResult Update(IModelStore department)
...

ModelStore has internal state like reference to DataContext and info on original/current data values. REST call can only transfer the public properties.

I can see the purpose of such function inside the server-side code, but not at part of the REST API. So, my questions are:

  1. Have I misunderstood this action completely?
  2. Any good example of how to use it when called via REST?
  3. If you want to pass list of departments in a REST call, why now simply use List?
    Server-side could then try to find each matching department to either update or insert depending on its PKEY value.

Any help greatly appreciated.

Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 7 August 2019 05:18 AM UTC
  2. SnapObjects
  3. # 1

OK, additional search + experiment ... and I see how ExportJSON/ImportJSON in a PB client supports the ModelStore JSON syntax with ease.

My initial perspective was: How can I leverage such API from a non-PB client app (EX: WPF app, Xamarin, or an Android app)? Answer: Difficult/complex - if feasible at all. However, having RESTful client = PowerBuilder app there is clear benefit of such API.

So in real-world app migrating from PowerScript to .NET I would probably start with REST API exposing IModelStore and then add IEnumerable as alternate API for same data/functionality.

Cheers, /Michael

Comment
  1. Logan Liu
  2. Wednesday, 7 August 2019 09:55 AM UTC
Hi Michael,



You are correct! In the server-side, we can use IModelStore to receive either PLAIN format (data only) or DataWindow/ModelStore format JSON (with both data and status in it). It's similar with .NET DataStore.



BTW: Appeon will focus on enhancing .NET DataStore and SqlModelMapper. ModelStore is not recommended for it is a compromise between .NET DataStore and SqlModelMapper, although it will still be available if you prefer to use it.



Regards,

Logan
  1. Helpful
  1. Michael Kramer
  2. Wednesday, 7 August 2019 10:01 AM UTC
Hi Logan, I will include that "product direction" info in my Elevate presentation on Web API Mechanics. THX! /M
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.