AV when enabling filter

Hi,

I am trying the filter feature.

I declare it in the class definition:

TLabel = class
...
[FilterDef('LanguageFilter', '{LangId} = :LangId')]
[FilterDefParam('LanguageFilter', 'LangId', TypeInfo(int64))]
[Filter('LanguageFilter')]
...

I use RegisterEntity for this class

When I call Enable Filter ('LanguageFilter').SetParam('LangId', 5) I have an acess violation apparently in :

function TMappingExplorer.FindFilterDef(
const FilterName: string): TFilterDefinition;
begin
Result := FFilterDefs.Find(FilterName);
end;

as if FFilterDefs is not assigned

Any hint ?

Regards

Jean-Michel

Your code looks normal, maybe the problem is somewhere else. Are you sure the TMappingExplorer is created, or was not destroyed? Any steps to reproduce the issue?

We have detected there is an issue indeed here. Next update (to be released very soon, next week) will include the fix.
The current workaround is to explicitly pass the mapping explorer when creating the object manager:

Manager := TObjectManager.Create(Connection, TMappingExplorer.Default);

Many thanks Wagner.

It works, but if I call EnableFilter before an entity was retrieved from the database, I have the message "Filter definition not found"

Since I want to enable the filter right after the manager was created, as a workaround I perform a Manager.Find before calling EnableFilter

Thank you, this will also be fixed.

Both issues fixed with Aurelius 5.1.
Many thanks for this great piece of software !

2 Likes

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.