DNN: ModuleSettings Vs TabModuleSettings

转自:
http://www.dotnetnuke.com/Community/ForumsDotNetNuke/tabid/795/forumid/137/threadid/75354/scope/posts/Default.aspx


They are both designed for slightly different purposes. ModuleSettings are unique to a particular ModuleID, that is when you place a new Reports module on the page (aka tab), it has a unique ModuleID and its own ModuleSettings. However, you can also place a copy of an existing Reports module from one page (aka tab) onto another page. This copy has the same ModuleID and shares its ModuleSettings with the other copy, but has a unique TabModuleID and its own TabModuleSettings. So basically, the idea is that the Data Source Settings are common to all copies of the same Reports Module, whereas the Display Settings can be different for each copy.

When developing your own module, you need to evaluate at which level the settings should go. My general rule of thumb is: If the setting has no effect on data access or manipulation and is purely a UI setting, it should probably be a TabModuleSetting, but if it must be shared among all copies of the same Module instance (for example, it affects the data retrieved/stored) then it should be a ModuleSetting.

大概的意思就是说:
ModuleSettings 是指一个模块的设置,每个模块都有个ModuleID,这些设置都是这个ModuleID独有的。
但是当你把这个模块的拷贝放在另一个页面的话,它的ModuleID不变,ModuleSettings也不变,但是系统会产生一个给它产生一个TabModuleID,对应的TabModuleSettings就是针对这个TabModuleID的。

当你开发模块时,你要考虑使用什么样的Settings,一般规则是: 如果这个设置对多个实例无效的的,它应该是TabModuleSettings,如果它必须被多个实例共享的话, 就应该是ModuleSettings。

posted @ 2007-11-12 17:43  Rose2007  阅读(337)  评论(0编辑  收藏  举报