Will try to register the stones I get in the process.
Using Delphi RIO 10.3.3 RemObjects 10 (build 1469).
Breaking change
Data dictionary field must now have an unique name between all the data dictionaries used n the project.
If don´t will raises an error: ‘duplicated not allowed’.
unit System.generics.collection line 7095
code
procedure TDictionary<TKey,TValue>.Add(const Key: TKey; const Value: TValue);
var
index, hc: Integer;
begin
if Count >= FGrowThreshold then
Grow;
hc := Hash(Key);
index := GetBucketIndex(Key, hc);
if index >= 0 then
raise EListError.CreateRes(@SGenericDuplicateItem);
DoAdd(hc, not index, Key, Value);
end;
Any chance to remove that restriction? I have many data dictionary fields with the same field name.
Will try to do a test case. Is a project working on 9.5, just try with version 10 and happens when try to access at runtime to a field present un several datadictcionary. My config is diferent. Each datamodule have schema, datadictionary and connections component. Load that from binary stream at runtime.
Ok, I test in depth,
The problem is raised when a DataDictionary have two fields with the same name. My original bug report was wroing.
That modification fix the error ignoring the second item. I ignore why schema modeler (old version) allow tio have many data dictionary fields with the same name. But if theres a reason then must find a way to allow to coexist both field name in the generics data dictionary .
procedure TSearcheableCollectionCached.RebuildList;
var
i: integer;
begin
{$IFDEF ROUseGenerics}
FNameList.Clear;
for i := 0 to Count -1 do
begin
// check theres not duplicated
if not FNameList.ContainsKey(AnsiUpperCase(GetItemName(Items[i]))) then
begin
FNameList.Add(AnsiUpperCase(GetItemName(Items[i])),Items[i]);
end;
end;
{$ELSE}
FNameList.Sorted:=False;
FNameList.Clear;
FNameList.Capacity:= Self.Count;
for i := 0 to Count -1 do
FNameList.AddObject(GetItemName(Items[i]),Items[i]);
FNameList.Sorted:=True;
{$ENDIF}
fNeedRebuild := False;
end;
Have sense have two fields with the same name in datadicionary? I have no idea. If it can happens just add my change.
you can’t have the same name (e.g. Field1) twice in the same data dictionary.
if it is possible, then it is a bug.
Why you can’t use template for name like %tablename%_%fieldname% ?
as a result, you will have something like table1_field1, Orders_ID, etc
Fine, will search the schema with the problem and fix.
Have no idea where to use that template. You mean in your code? In the data dictionary name at the schema editor?
If you mean in the schema , that template mis the opposite to the data dictionary use. Is suss pose to be reused on another tables, right? For that reason I change the proposed name .