Try our conversational search powered by Generative AI!

Allow constructor dependency injection in Forms Actors


Why you are creating new actor instances via Activator.Createinstance (EPiServer.Forms.Core.PostSubmissionActor.ActorsExecutingService)?

Sep 13, 2016 12:57

Hi Valdis,

Please imagine the Actor is kind of "static" mission, executes after form posted, similar to

  • the task in schedule task runs on specific-time
  • InitModule runs on beginning of the web app

ActorsExecutingService is used for executing the Actors. It is the default implementation and you can replace its business if you don't like the its business workflow.

  • Fetch all derived types of IPostSubmissionActor
  • And create instance via Reflection, yes
  • Provide context information (http request), form context (form id, submission id, submission data), configured model (from Editor UI)
  • and execute it

I don't think it is kind of generic purpose instance that you instantiate and use it solely. If you need that kind of freedom in specific project, using the Event mechanism is better.

Oct 18, 2016 4:48
This thread is locked and should be used for reference only.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.