I need to fetch a number of elements in child collection, but don't want to persist it. Here is the code to illustrate my situation:
C#[Association]
public XPCollection<CoolClass> Cools { get { return GetCollection<CoolClass>("Cools"); } }
int _cnt = -1;
[PersistentAlias("Cools[].Count()", Fetch=True)]
public int CoolsCount {
get { return (Cools.IsLoaded || _cnt < 0) ? Cools.Count : _cnt; }
set { _cnt = value; }
}
override OnLoading() {
_cnt = -1;
}
Proposed Solution:
Add a ReadOnly parameter to the PersistentAlias attribute
Does this Fetch option in the attribute work? I tried to set it and does not seem to work. Since this is an old post I wonder if there is any other solution to this problem…
@Andreas:
This ticket describes a feature request that is not implemented yet. The code provided here is supposed to illustrate how a persistent calculated property can be declared when the feature is implemented. This code doesn't work in the current version.
There's no universal solution at the moment. If you need a solution for a specific scenario, please create a new ticket and describe your scenario in detail. We will do our best to help you.
Also refer to the discussion in the S36566 ticket.
Hi,
This is still not implemented?
Regards,
Mario
@Mario:
The original proposed solution is not implemented.
Would you please submit a separate ticket using the https://www.devexpress.com/Support/Center/Question/Create service and attach your test samples with your persistent classes code, so we can replicate and research your concrete business requirements and tell you for sure whether there are already suitable solutions in the current version and whether they are ever related to the current thread (or can be addressed differently)? We want to help you and look forward to hearing from you.