DataPortal FetchChild runs locally when called from ExecuteAsync method of business rule #3411
-
@rockfordlhotka - This is a continuation of the discussion that we had on Discord. As you may recall, I was having an issue where the injected DAL object was coming up null when I was performing a FetchChild from within the ExecuteAsync method of an asynchronous business rule. You provided me with a working example where you used an injected ApplicationContext within your FetchChild. Having done more digging, I had added an injected ApplicationContext to my FetchChild alongside my injected DAL, and while my DAL was still null, the ApplicationContext was not. So it turns out that I'm using a remote Data Portal, so what was happening was that because ApplicationContext is both local and remote, it would show up. Once I added my DAL layer to the local side, it worked. So what I think is happening is that when the FetchChild is being called from the ExecuteAsync business rule method, it is running locally and not remotely. I've put together a sample based off of yours to illustrate this here: https://github.com/mtavares628/CslaRuleDataPortalTest Can you take a look? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Oh, that's normal. The child data portal always runs where it is invoked. Only the full data portal invokes a remote server (if configured). If your child data portal needs to be remote then you need a command object to transport it. I your case I'd implement this using a ReadOnlyBase subclass. |
Beta Was this translation helpful? Give feedback.
Oh, that's normal. The child data portal always runs where it is invoked. Only the full data portal invokes a remote server (if configured).
If your child data portal needs to be remote then you need a command object to transport it. I your case I'd implement this using a ReadOnlyBase subclass.