C#C
C#5mo ago
Myrcin

Design

Hi everyone. I've got a design problem to solve. I want to be able to create separate Task classes that would be resolved by TaskService class which would store the tasks in a database when executed. The TaskService class would invoke Execute method and somehow determine which task to run (I'm thinking either enum or type). so that is simple enough, but I want this to be a library that would have intellisense for others to use: so I'm looking for a solution when someone enters _taskService.Execute(<enum>) they know what parameters to pass and what is the return value. I tried generics in the following way: _taskService.Execute<TInput, TOutput>(<enum, parameters), but in this way the user has to know what input and return value to specify instead of having intellisense. Would the only way be to create a registry with the tasks and give each one of them a method like: _taskRegistry.ExecuteTaskEmail(string email)? looking for any help to write a nice extensible task service library with intellisense. Thanks
Was this page helpful?