Reputation: 26
I am trying to create an event handler for sitecore .
I have done following steps.
<handler type="TestEventHandlers.EventHandler , TestEventHandlers" method="OnItemSaved"/>
But i am getting following error:
Could not resolve type name:
TestEventHandlers.EventHandler, TestEventHandlers.EventHandler
(method: Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert)).
I am confused about assembly name in type attribute of handler.
Upvotes: 1
Views: 1926
Reputation: 351
Assuming dll name as- TestEventHandlers.dll , & class description as - namespace TestEventHandlers.Events{ public class EventHandler{...}} your handler entry shuld be < handler type="TestEventHandlers.Events.EventHandler , TestEventHandlers" method="OnItemSaved"/>
Upvotes: 0
Reputation: 4008
The assembly-qualified name of a type consists of the type name, including its namespace, followed by a comma, followed by the display name of the assembly. > MSDN
The assembly-qualified name for you class might look like this:
TestEventHandlers.EventHandler, TestEventHandlers
Assuming that your dll (assembly) is named TestEventHandlers
and the class you wrote is called EventHandler
within the TestEventHandlers
namespace. In other words, you have this code in your TestEventHandlers
dll and that dll is in the bin directory of your Sitecore web site.
namespace TestEventHandlers
{
public class EventHandler
{
public void OnItemSaved(object sender, EventArgs args)
{
}
}
}
Upvotes: 10