2
 Followers
10
 Likes

Entity - Generated "Create Or Update" Entity Actions

Backend
On our radar

An Entity should have an option to automaticly generate a Entity_CreateOrUpdate action with server side validations, taking into account the properties of the attributes in the Entity (E.g. mandatory fields). In this way, we would have basic validation per entity in the Core Service modules and not only in the End User Modules. 

Created on 15 Nov 2017
Comments (10)

I agree this can be helpfull, but I think everybody models this kind of functionality in a different way. So it should be configure (folder, name of the created action, which validations) else you'll end up with adjusting a lot.

Well, I disagree with Evert. imho, those wrappers should be structured like already created actions:


<entityname>

-createorupdate

-create

-..


and tbh, i don't care on this low level naming ;)




Merged this idea with 'Would the use of validation server actions be an option?' (created on 20 Jun 2018 12:17:50 by René Cornet)

Instead of validating alterations (add, modify and delete) on tables at several places in parts of modules that approach these tables, it might be better, in my opinion, to perform these validations in special server actions. Maybe it is even better to create a special module for it that is stacked on the ‘Core’ module. Validations, for a specific alteration on a certain table, are always performed the same way in that case, no matter where the server action is initiated (screen, process …).


Having these special server actions, it is also easy to perform inter table validations. The deletion of a record of table A might result into an update of table B. If the update of the B-record is not allowed due to its validations, the deletion of the A-record may not take place either. This implies that the server action ‘ValidationCreateOrUpdateTableB’ is started within ‘ValidationDeleteTableA’. To instruct the caller, an output parameter should return the result of the validation. So, the outcome might be a description about the validation error or just empty if okay.


Introducing the validation server actions will imply that the database actions ‘CreateOrUpdateTable’, ‘CreateTable’, UpdateTable’ and ‘DeleteTable’ should not be used anywhere outside their validation server actions anymore.


The ‘ValidationCreateOrUpdateTable’ server action should check whether the input Id prameters is empty or not. If empty (nullIdentifier), the ‘ValidateCreateTable’ action should be started. When this action returns an empty value (a correct validation and an insertion), a new Id is returned as well. However, when the action returns an error description, the complete action should be cancelled. If the insertion is correct, but the following update is not correct, an abort transaction should be performed to undo the insertion in that case.


Would the use of validation server actions be an option?



Merged from 'Would the use of validation server actions be an option?' (idea created on 20 Jun 2018 12:17:50 by René Cornet), on 02 Jul 2018 09:57:06 by Fernando Moitinho

Hello René,

First, what is your Idea behind this?

Second, that's what you should do based on your use cases and business logic that your application requires. 

They depend very much on the business logic that you need to implement and aren't equal to everyone. 


The Server actions you talk should be in same module where you have the Entities and only those server actions should be public and your entities should be public and Read-Only.


Abílio Matos



Merged from 'Would the use of validation server actions be an option?' (idea created on 20 Jun 2018 12:17:50 by René Cornet), on 02 Jul 2018 09:57:06 by Fernando Moitinho

Hello Abilio,

The idea behind it is to have a single point of validation per table access type (create, update, delete).

I was creating an application in which records could be altered on the screen and records could be altered via JSON Restful webservices. For both entry points I was coding validations. So, i decided to call a server action for each validation.

I agree it is even better to store the validation table access actions in the database layer itself. Do you know if there is any documentation (course) about this topic?


René Cornet  



Merged from 'Would the use of validation server actions be an option?' (idea created on 20 Jun 2018 12:17:50 by René Cornet), on 02 Jul 2018 09:57:06 by Fernando Moitinho

René,

This topic is also approached in 4 Layer Canvas architecture and in several courses, some more encapsulated than others, like the ones from Becoming a Web Developer guided path.


Abílio Matos



Merged from 'Would the use of validation server actions be an option?' (idea created on 20 Jun 2018 12:17:50 by René Cornet), on 02 Jul 2018 09:57:06 by Fernando Moitinho

This is standard architectural practice.

THAT SAID...

The system does not support it well. For example, the drag/drop stuff more or less breaks down once you start using four layer canvas.

There are a number of related, but not identical ideas (nothing close enough for me to merge these) out there already.

J.Ja



Merged from 'Would the use of validation server actions be an option?' (idea created on 20 Jun 2018 12:17:50 by René Cornet), on 02 Jul 2018 09:57:06 by Fernando Moitinho

Hi Fernando, 

What I actually intended to say is more about functional validations. Technical validations are performed very well by the current statements for adding, updating and deleting records, but is it also functionally allowed to delete a record,  do I need to update another table when I create a record, ... ? These functional validations should be performed, in my opinion, at one point per table and per table access type. The technical validations are performed during the actual table action.

René

Hi René,

I've merged your idea with an already existing one. The main goal is to have automatically generated actions for Create / Update / Delete where the user can customize this action to fulfill business requirements.

Thanks,

views
531
Followers
2