Terminology question

Topics: CAB & Smart Client Software Factory
Dec 29, 2006 at 10:10 AM
originally posted by: MarcoPaul

When raising events from a class, it is considered good practice to define a virtual method that raises the event in order to allow derived classes access for overriding.

Basically, when the class is added to the workitem, the workitem scans the class for any eventpublication attributes and registers any with the event publication system (grossly simplified).
Jan 7, 2007 at 7:50 AM
originally posted by: crickard62

Please be gentle, I come from a VB.NET world where this stuff is done for you automatically. It seems like most SCSF examples use C# so here I am but I am having a little trouble with terminology. Let's say I define an EventPublication like this:

EventPublication(EventTopicNames.AccountTypeChanged, PublicationScope.Global)
public event EventHandler<EventArgs<AccountStructure>> AccountTypeChanged;

SCSF automatically creates a method for me that looks like this:

protected virtual void OnAccountTypeChanged(EventArgs<AccountStructure> eventArgs)
if (AccountTypeChanged != null)
AccountTypeChanged(this, eventArgs);

Here are my questions:
- If AccountTypeChanged is an "EventHandler Delegate", then what do you call "OnAccountTypeChanged". Is this just called an "EventHandler"?

- How are we getting from the "AccountTypeChanged" declaration to "OnAccountTypeChanged" method? What exactly is EventPublication attribute doing for us behind the scenes?