View Issue Details

IDProjectCategoryView StatusLast Update
0004014JEDI VCL03 Donationspublic2006-12-17 14:45
ReporterwessonAssigned Tojfudickar 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0004014: Fix incomplete storage of collections
DescriptionCollections are also persistent objects. when they are saved/loaded inside a tree of persistent/collections objects, only their "collection" part is saved, and not the "persistent" part.

For instance, if a collection contains a published property

published
  property MyTagToSave: Integer read FyMyTagToSave write SetMyTagToSave;

it'll not be saved.

My proposal is to Add in ReadCollection/WriteCollection a ReadPersistent/WritePersistent inside
Additional InformationProposed code:

function TJvCustomAppStorage.ReadCollection(const Path: string; List: TCollection;
  const ClearFirst: Boolean = True; const ItemName: string = cItem): Integer;
begin
  if not ListStored(Path) and StorageOptions.DefaultIfValueNotExists then
    Result := List.Count
  else
  try
    List.BeginUpdate;
    if ClearFirst then
      List.Clear;
    ReadPersistent(Path,List,True,False); // Collection is also a persistent
    Result := ReadList(Path, List, ReadCollectionItem, ItemName);
  finally
    List.EndUpdate;
  end;
end;

procedure TJvCustomAppStorage.WriteCollection(const Path: string;
  List: TCollection; const ItemName: string = cItem);
begin
  WriteList(Path, List, List.Count, WriteCollectionItem, DeleteCollectionItem, ItemName);
  WritePersistent(Path,List); // Collection is also a persistent ...
end;
TagsNo tags attached.

Activities

2006-12-08 08:45

 

JvAppStorage.rar (20,821 bytes)

jfudickar

2006-12-17 14:45

developer   ~0010466

Thanks for the hint. I've missed this.

NOw in svn.

Issue History

Date Modified Username Field Change
2006-12-08 08:45 wesson New Issue
2006-12-08 08:45 wesson File Added: JvAppStorage.rar
2006-12-13 10:49 jfudickar Status new => assigned
2006-12-13 10:49 jfudickar Assigned To => jfudickar
2006-12-17 14:45 jfudickar Status assigned => resolved
2006-12-17 14:45 jfudickar Resolution open => fixed
2006-12-17 14:45 jfudickar Note Added: 0010466