Hello,
common use case when performing .NET datastore update in API Service is
1) send restclient.Submit( ... dw_1) or restclient.sendPostRequest( ... dw_1.exportJson(True) ) from PB client
2) perform restclient.Retrieve(dw_1 ...) from PB client to refresh DW buffers
I was wondering if can avoid 2nd server call, since the API can return the datastore instead of the ds.update() return code
But the PB client seems unable to perform a new update and have its update flags in sync with API datastore
For example, Service's UpdateAsync below from Snapdevelop scaffolding is modified to return IDataStore<Department> instead of int.
public async Task<IDataStore<Department>> RetrieveAsync(CancellationToken cancellationToken)
{
var dataStore = new DataStore<Department>(_dataContext);
await dataStore.RetrieveAsync(new object[] { }, cancellationToken);
return dataStore;
}
public async Task<IDataStore<Department>> UpdateAsync(IDataStore<Department> department, CancellationToken cancellationToken)
{
department.DataContext = _dataContext;
await department.UpdateAsync(cancellationToken);
return department; // not working. UpdateAsync(true, cancellationToken) not working either
//return await RetrieveAsync(cancellationToken); // not working either
}
PB client is sending update and then refreshing the DW with API response, but a subsequent second update fails (in e.g. duplicate key and http 500 return code).
restclient.setRequestheader( "Content-type", "application/json" )
restclient.Submit( ls_endpoint, ls_response, dw_1)
dw_1.Reset()
// Attempt to refesh DW state on the client, and avoid new retrieve
dw_1.importJson(ls_response)
I would like to avoid this new server call to have proper refresh on PB DW
restclient.Retrieve(dw_1, ls_response)
Thanks for sharing any idea.
.m