Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Thu Aug 28, 2008 8:17 am Post subject: INFO: Efficient implement of the Serialize and DeserializeChild methods |
|
|
The DeserializeChild method of NSEFolder class is called multiple times for each item in the namespace extension as Windows Explorer (or another browser program) tries to retrieve information associated with the item such as its displayname, icon, infotip, etc. The Serialize method is called once for each item. For this reason, the implementation of the DeserializeChild and Serialize methods should be as efficient as possible. Unnecessary operations such as web access, database queries, file-system access and other such potentially time-consuming operations should be avoided.
Furthermore, the Serialize method should store only that data which is necessary to completely identify the item. Other data associated with the item can loaded afterwards as and when necessary.
For example:
RegsitryBrowser sample:
ValueItem class : only value name and full path of parent key is serialized - this is all that is required to identify the item. The 'value data' associate with the ValueItem is not serialized since it can be loaded only when required from the registry.
FileSystemBrowser sample:
Folderitem/FileItem class : only fullpath is serialized - this is all that is required to identify the file/folder. Other information such as file size, date modified, file type etc is not serialized since it is not required and can be loaded only when required from the file-system. |
|