I want to save the name of API to the database and call it after that. How can i do that?
Example:
I want to save the name of these APIs (Action1
, Action2
and Action3
) into the database and call it when I need (because I want to reorder or delete some actions in the UI):
public interface IMyAppService : IApplicationService
{
Task Action1();
Task Action2();
Task Action3();
}
So how can I store the API name as string in database and how to execute it after that? Should I store them like this?
"http://localhost/api/services/mpa/myApp/Action1"
"http://localhost/api/services/mpa/myApp/Action2"
"http://localhost/api/services/mpa/myApp/Action3"
You have 2 options:
save it by URL + use HttpClient
, or
save it by AppService and method names + use reflection.
IAbpSession.Use()
block.For completeness sake, this question is the first of a series of other Stack Overflow questions: