If a business object contains a persistent alias, list view evaluates the property for all lines by executing a general select (not a count sql for example). In linq queries, these persistent aliases are transformed to related sql's so performance is very high. I know I can use Linq for XAF list views but it causes loosing many functionalities in list view. I also checked that if I define a criteria over persistent alias in list view criteria property, it is evaluated by transforming to related sql.
So is there a way to make xaf list views interpret the related persistent alias and transform it to for example count statement?
Below is a select statement which correctly filters list view according to detail item count without loading all details by using selects. (Linq also correctly create selects by interpreting persistent alias attributes so I think list view loading can be optimized dramatically.)
select N0."Oid",N0."Name",N0."OptimisticLockField",N0."GCRecord" from "dbo"."Master" N0
where (N0."GCRecord" is null and ((select count(*) as Res from "dbo"."Detail" N1 where ((N0."Oid" = N1."Master") and N1."GCRecord" is null)) > 999))
Hello,
We could replicate this problem with a non-XAF sample project where the following field was used:
[PersistentAlias("Details.Count")] public int DetailCount { get { return Convert.ToInt32(EvaluateAlias("DetailCount")); } }
We need some additional time to research this behavior. Your patience is highly appreciated.