November Happy Hour will be moved to Thursday December 5th.

Allow constructor dependency injection in Forms Actors

Vote:
 

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

#155277
Sep 13, 2016 12:57
Vote:
 

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.

#162841
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.