BO that support synchronous and ansynchronous factory methods #1817
-
I want BO's to support both synchronous and asynchronous static factory methods. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think you misunderstand how the data portal works, as I don't think there is any reason to do what you are describing. The client-side data portal is where you invoke the data portal: var obj1 = DataPortal.Create<MyBusinessType>();
var obj2 = await DataPortal.CreateAsync<MyBusinessType>(); The server-side data portal is where you implement data portal operation methods. Whether a data portal operation is implemented as an async method depends entirely on whether your method needs to invoke an async API to create/fetch/update the data. [Create]
private void Create()
{
// create the object without calling any async APIs
} or [Create]
private Task CreateAsync()
{
// create the object by calling async APIs
} It doesn't matter whether your client-side calls are sync or async, that depends on how you want your UI to work. The data portal takes either type of client-side call, relays it to the app server, and invokes the server-side data portal operation method. |
Beta Was this translation helpful? Give feedback.
I think you misunderstand how the data portal works, as I don't think there is any reason to do what you are describing.
The client-side data portal is where you invoke the data portal:
The server-side data portal is where you implement data portal operation methods. Whether a data portal operation is implemented as an async method depends entirely on whether your method needs to invoke an async API to create/fetch/update the data.
or