Friday, July 19, 2019

Small Remark about Sitecore Agents

It is possible to create Sitecore agents that could be configured via parameters from configuration files. E.g.:

  <agent type="YourNamespace.SomeAgent" method="Run" interval="00:05:00">
    <param desc="database">master</param>
    <param desc="website">shell</param>
  </agent>

and you have constructor to initialize agent: SomeAgent(string database, string website).

Desc attribute in configuration is used only for description of parameter. And if you occasionally change order in configuration file, you will get different order in your constructor. Database will become website. Website will become database.

So, here is reminder: order of parameters in configuration of Sitecore agents matters. Desc attribute is used only for information and nothing else.