-> 8.9, Jquery
When the RAD tool scaffolds an entity with a boolean property, that uses filtering, it generates WHEREIF statements such as
.WhereIf(input.HasScheduleFilter > -1, e => (input.HasScheduleFilter == 1 && e.HasSchedule) || (input.HasScheduleFilter == 0 && !e.HasSchedule))
What I'm seeing is the input object's int property is 0 by default, resulting in it always being filtered.
Is anyone else experiencing this, or am I doing something wrong.
If I'm doing it correctly, then my solution has been to set a default value for boolean properties in the GetAll<entity>Input class, such as:
public int HasScheduleFilter { get; set; } = -1;
For scaffolding purposes, I'd suggest setting that default value for boolean properties (which are ints in the input class it creats) in the GetAllForLookupTableInput template files for RAD tool, if you're going to use this logic for the WhereIf, to avoid having to explicitly set this to -1 when doing something like:
var Object = await _<entity>AppService.GetAll(new GetAll<entity>Input()
{
HasScheduleFilter = -1,
});
2nd question - does my setting these default values to -1 raise any potential issues I'm not aware of?
3 Answer(s)
-
0
Hi @marble68,
Could you create an issue on GitHub for Question 1 ? This seems like a bug, we will fix it. For Question 2, it will not cause a problem.
-
0
Will do.
-
0
Thanks,
here is the issue for reference https://github.com/aspnetzero/aspnet-zero-core/issues/3386