Print Page | Close Window

IModule and ModuleInit

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=348
Printed Date: 27-Apr-2026 at 2:40am


Topic: IModule and ModuleInit
Posted By: Linguinut
Subject: IModule and ModuleInit
Date Posted: 01-Aug-2007 at 11:39am
The IModule interface has two methods: AddServices() and Load().  The two methods are implemented in the ModuleInit abstract class.  The SalesRepModule class overrides only the Load() method.  The AddServices() method is not implemented.  Is there a reason why Cabana chooses not to implement that method but rather introduce a new AddServices() method into the controller class?
 
Thanks,
Bill



Replies:
Posted By: Linguinut
Date Posted: 01-Aug-2007 at 1:11pm
Here is a followup to the original question:
 
There are five methods expressed in the controller run command--
 
AddServices()
ExtendMenu()
ExtendToolStrip()
AddViews()
AddPageSubscriptions()
 
The middle three are static methods.  Why are these static and the other two are not?  Or, should the other two be declared static, as well?


Posted By: Bill Jensen
Date Posted: 01-Aug-2007 at 4:31pm
The Module class has access to the parent workitem only.  There it would be appropriate to add services that need to be accessible to other modules.
 
The module controller has access to the module's workitem and can add services (and other items) that should be local to the module (and its child workitems).
 
The three static methods you mention are empty.  Methods that do not depend on the members of the class are often marked static to avoid the overhead of passing the instance reference.  FxCop suggests this and ReSharper may do it automatically. 
 
Bill J.


Posted By: Linguinut
Date Posted: 01-Aug-2007 at 5:18pm
Gotcha...thanks!!



Print Page | Close Window