276
Views
6
Comments
Dynamically calling an Action
Question
Any ideas on how to dynamically calling an Action in the same sort of way of using a Delegate in C#?
I would like to have a datamodel capable of storing the rules that when a certain record is updated to a certain value (in detail, it's a Status field: "Submitted, Completed, Closed, ..."), then a parameterized Action, for that status transition, is called. The important thing here is being able to parameterize the Action being called, preferably using the datamodel to do so.
Thanks in advance for any suggestions.
UserImage.jpg
22bc63ff-d68c-4193-824e-d79d2714f8b3
Hi,
 
From your status field i believe it would be better to have 3 different actions to acomplish this, but if you realy want to use just one you need to check your Status field value, I imagine Status field is an atributte of some entity?

So i would suggest this logic approach to the situation:


Hope it helps.

Best Regards,
Miguel Vieira
2012-09-21 16-23-56
Francisco Vasco
Not quite what I need :)
What I meant with dynamically calling an Action, was, for example, to call a Web Service X, but be able to change which Web Service is called without having to change my application's code (just by maintaining the correlation between status A and Web Service X or Y in some data model).
2016-03-03 15-03-17
Sumo
Francisco Vasco wrote:
Not quite what I need :)
What I meant with dynamically calling an Action, was, for example, to call a Web Service X, but be able to change which Web Service is called without having to change my application's code (just by maintaining the correlation between status A and Web Service X or Y in some data model).
This might help you.  As I would expect, it will require writing some C# code.
https://www.roelvanlisdonk.nl/?p=3545
2016-03-03 15-03-17
Sumo
I'm also interested in this as I want to be able to create a mapping between Active Directory groups and OS roles to grant.  But, to do that efficiently, I need to be able to call the role actions dynamically (Check/Grant/Revoke).
2016-05-08 18-57-20
Luis Camarena
Great find Sumo... this actually helped solve something similar we were looking to achieve.  Figured that there must be an easier way.
2016-03-03 15-03-17
Sumo
Luis Camarena wrote:
Great find Sumo... this actually helped solve something similar we were looking to achieve.  Figured that there must be an easier way.
 Now the trick is to figure out how to call Actions that take parameters.  :)
 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.