New .NET DataStore project type

The PowerBuilder CloudPro and Professional editions support a new project type called .NET DataStore project. You can use this project to convert PowerBuilder DataWindows to .NET DataStore models and generate RESTFul Web APIs from the models.

A C# solution will be generated automatically to hold the .NET DataStore models and the services and controllers when you build the .NET DataStore project. You can compile and run the C# solution to expose the Retrieve and Update services as standard RESTFul Web APIs, and then consume these APIs from the client via PowerScript, HTML etc. You can complete all these steps (including compiling the C# solution) in the PowerBuilder IDE (without needing to use SnapDevelop or other C# editor).

The RESTFul Web APIs can incorporate built-in auth templates for authentication control (similar with the approach provided by PowerServer projects).

For more information, refer to the section called “Working with a .NET DataStore project” in Users Guide.

The PowerBuilder RESTClient object is added with the following functions in order to support the DataWindow to interact with the .NET DataStore model via the APIs:

Note

The following functions will NOT work with the .NET DataStore models generated in SnapDevelop; they can only work with the .NET DataStore model generated in the PowerBuilder .NET DataStore project.

  • RetrieveWithModel -- Retrieves data for one DataWindow, DataWindowChild, or DataStore using the .NET DataStore Web API.

  • UpdateWithModel -- Updates data for one DataWindow, DataWindowChild, or DataStore using the .NET DataStore Web API, and commits changes to the database automatically if succeed, otherwise, rolls back the changes automatically.

  • RetrieveOrUpdateWithModels -- Retrieves or updates data for more than one DataWindow, DataWindowChild, or DataStore using the .NET DataStore Web API, and commits changes to the database automatically if all succeed, otherwise rolls back all of the changes if any DataWindow failed. It has a new parameter BatchDataObjects to group multiple DataWindow/DataStore/DataWindowChild objects for batch processing.

The DataWindow/DataStore/DataWindowChild used at both the front-end and back-end is identical, and the DataObject is automatically assigned to the function (no need to specify the DataObject as a separate parameter).

There is mo need for manual data packaging, that is, manually packing and unpacking the JSON data for transmission between front-end and back-end. Import/export of data are completed automatically.

BatchDataObjects is a new object to work with RESTClient to perform retrieve/update operations for multiple DataWindows at one time (so as to enhance performance in the front-end and back-end interactions):

  • AddRetrieveObject -- Adds DataWindow/DataStore/DataWindowChild objects that need to retrieve data.

  • AddUpdateObject -- Adds DataWindow/DataStore/DataWindowChild objects that need to update data.

  • GetCount -- Gets the total number of DataWindow/DataStore/DataWindowChild objects (including retrieve and update) in BatchDataObjects.

  • GetErrorIndex -- Gets the index of the DataWindow/DataStore/DataWindowChild object where error occurs.

  • GetResponseAdditionalData -- Gets the additional string data in the response.

  • GetSQLDBCode -- Gets the SQLDBCode of the DataWindow/DataStore/DataWindowChild object where error occurs.

  • GetSQLErrText -- Gets the SQLErrText of the DataWindow/DataStore/DataWindowChild object where error occurs.

  • Reset -- Resets the BatchDataObjects object to the initial state.

  • SetAdditionalData -- Sets the additional string data to be added to the request.