Master Data on Core Layer Architecture

I am trying to build modules for "Core Business Layer", where a module will contain multiple Entities. For example, if I create an "Inventory" module, it will contain master data Entities and transaction Entities. 

After creating the core module, I want to build an End-User Layer for Web, referencing the core modules. But as stated in the document, it is a best practice to set Entities on the core module as read-only, and create reusable logic to be consumed by the End-User Layer.  

The problem is, I need to manage master data on the web (End-User Layer), and if the master data Entities are not set to public, I cannot benefit from the RAD tools like scaffolding the form using drag and drop and need to create extra "server action" to allow CRUD operation. In this case, what is the best practice to design the Architecture? Is it a good idea to set master data Entities public, and set transaction-related Entities to private?



Thanks

Hi Henry,

I will recommend to create your master entities as Public with ReadOnly option enabled and to perform CreateOrUpdate/Delete  operations, you can create public actions in your core module and can use them in End-User layer. 

And Yes it is a good idea to set master data Entities as public, and transaction-related Entities to private. [You can manage transaction related activities in the core layer actions]

By doing this you will also follow Outsystems recommended approach. 

Hope this will help.

Solution

Hi henry, how is it going?

It is indeed a good practice to keep master data "protected" under a core layer module. So, you got it right!

Of course, it always depends on your use case. So, if you need to build a quick PoC just validate a concept with a client, for instance, it's not worth it using this approach in the beginning, as it might affect your delivery time.

But, yes, keep this in mind if you're looking for long-living apps, with good maintenability and a happy team!


Now, to your point around leveraging scafolding, what you can do is:

1. Set your entities as public, just while you're building your screens. Then you'll be able to drag and drop the entities to generate list and details pages.

2. Create wrapper actions to encapsulate your entity's Create/Update/Delete operations. I normally do it in a lower level module, under the Core business, closer to the Database. This module would be consumed by the Core Business (Business rules) module.

3. Change your entities back to read only. When you refresh the references in the front-end module you'll see reference errors popping out, which you easily solve by replacing the invalid actions with the wrapper ones you created.


Have fun! :)

Solution

Thanks all for the answers, really appreciate it