I'm new in this platform. And when I started modeling some databases I've asked myself: "Why use a Exposed read only entities?". I've only asked that because when the propertie "expose read only" is setted to "No" the use of the data is faster than when we use it as "Yes". So, why use it at all?

But It's called a best-practice. Why?

I've searched the platform and I hadn't found  the answer.

Thank you for the info.

Solution

Hi Lucas,

This is the best-pratice because you can create business roles do create registers in the entity in an one place like a Server Action, for example.

Some benefits:

1) Improve maintability and prevents that the entity is manipulated in a wrong way, because the logic is in the one place

2) The business logic is the same for all other applications mobile, micro-service and etc.

Solution

Hi Lucas,

Don't know about "using data being faster" if the data is exposed as read only. In fact, I don't think there is any difference.

It is a best practice in terms of maintenance.

An entity may be accessed by many different modules, or even applications. 

If you allows all of those places to write data to the entity, any validation required to the data that is forgot by the developer will cause problems.

When you expose read only and create wrappers for the entity (to write data), you guarantee that everybody has to do it using this channel. Much easier to keep track and prevent issues.

Justin James has some nice articles about Entity Wrappers. 

https://medium.com/@jmjames/outsystems-crud-wrapper-basics-e9a577a3e044

https://medium.com/@jmjames/outsystems-crud-wrapper-checklist-c7efb2ad9115

Hope this helps.

Cheers.

Leandro Correa wrote:

Hi Lucas,

This is the best-pratice because you can create business roles do create registers in the entity in an one place like a Server Action, for example.

Some benefits:

1) Improve maintability and prevents that the entity is manipulated in a wrong way, because the logic is in the one place

2) The business logic is the same for all other applications mobile, micro-service and etc.


Thank you for the info!

Eduardo Jauch wrote:

Hi Lucas,

Don't know about "using data being faster" if the data is exposed as read only. In fact, I don't think there is any difference.

It is a best practice in terms of maintenance.

An entity may be accessed by many different modules, or even applications. 

If you allows all of those places to write data to the entity, any validation required to the data that is forgot by the developer will cause problems.

When you expose read only and create wrappers for the entity (to write data), you guarantee that everybody has to do it using this channel. Much easier to keep track and prevent issues.

Justin James has some nice articles about Entity Wrappers. 

https://medium.com/@jmjames/outsystems-crud-wrapper-basics-e9a577a3e044

https://medium.com/@jmjames/outsystems-crud-wrapper-checklist-c7efb2ad9115

Hope this helps.

Cheers.

Thanks for the info and for the links. Justin James has a new fan.