Closed JasonBock closed 4 years ago
They can return void
or Task
.
Good idea for an analyzer.
Also, were they trying to call DP_Execute directly? An analyzer saying that you can never call these methods directly would be good too :smile:
Since I'm on a roll recently with analyzers, @rockfordlhotka, want to move this to a CSLA issue? I'd want to focus strictly on checking the return value for an operation method and say it can be either void
or a Task
. Checking to see if someone is invoking an operation directly should be a separate issue.
With respect to this second idea, are you saying code should never invoke an operation method directly, whether they're in an ObjectFactory
instance or not?
Yes, this would be a good analyzer.
It is true, nobody should be calling DP_XYZ methods directly. I'd like to say that's true of ObjectFactory
methods also, but really we're mostly hands-off with how/when people build and use those factories, so I'd say we should not block direct calls to those methods.
OK, to be clear....
Locking this thread so all discussion goes to the actual work issue.
Hey @rockfordlhotka any reason this should still stay open, or close it? I think this is done...
At a client, someone decided to define
DataPortal_Execute()
like this:They thought they'd be able to return a
string
from aDataPortal.Execute()
call, which, of course, didn't work.This got me to thinking....should I create an analyzer that ensures that any DP operation has a return of
void
? I'm thinking that this would be an error condition.What cases am I missing if I do this?