CSLA 6: Using services within a PropertyRuleAsync #2719
-
CSLA 6 Blazor Wasm/HttpPortal I'm updating an older code base, is there a recommended approach to injecting services into a async property rule for CSLA 6. Consider the following simplified example:
First issue would be that CreateInstanceDI can not create an instance if T is an interface (I have a workaround for this, but not to get distracted from the main point...) My thoughts are that we need to inject the scoped service each time the rule is run (PropertyRuleAsync.ExecuteAsync()) RuleContext could be modified to allow services to be created from the scoped service provider, something like below.
RuleContext has a private scoped ApplicationContext so should be doable. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The next preview will include a |
Beta Was this translation helpful? Give feedback.
The next preview will include a
GetDataPortal
method for business and auth rules. The method is on the context, and will enable you to get access to anIDataPortal<T>
that can be used to invoke commands or do other operations. #2682