Dear ladies and sirs.
I have two entities types:
- RunContainer parent entity type
- Run child entity type
Run has a property Status, which is of type RunStatus, like so:
public enum RunStatus
{
Created,
Starting,
// ...
}
public class Run
{
public int ContainerId { get; private set; }
// ...
public RunStatus Status { get; private set; }
}
RunContainer has a calculated property ActiveRunCount, like so:
public class RunContainer
{
public int Id { get; private set; }
// ...
public int ActiveRunCount { get; private set; }
}
In the mapping for the RunContainer.ActiveRunCount
property, I use the formula specification like so:
<property name="ActiveRunCount" formula="(select count(r.Id) from Run r where r.ContainerId = Id and r.Status = 1)"/>
My problem is that I refer to the RunStatus enum values in the formula by their respective numeric value, rather than the appropriate symbolic name. Can anyone tell me how can I use the symbolic name instead?
Thanks.