Orm |
| Exception | Condition |
|---|---|
| InvalidOperationException | When a WHERE clause has already been appended |
This instruction appends a SQL WHERE clause to your query. This can only be called once on a particular instance
of a IQueryResultSetTData or else an invalid state is created. When calling directly from a persistence layer such as:
var results = persistenceService.Query(o => o.StatusConceptKey == StatusKeys.Active, AuthenticationContext.Current.Princiapl);
var filter = results.Where(o=> o.CreationTime > DateTime.Now); // invalid state
The method is intended for new result sets, for example, consider:
var results = persistenceService.Query(o => o.StatusConceptKey == StatusKeys.Active, AuthenticationContext.Current.Princiapl);
results = results.Union(o => o.StatusConceptKey.New);
var filter = results.Where(o=> o.CreationTime > DateTime.Now);
Since the equivalent function in SQL is:
SELECT *
FROM (
SELECT *
FROM x
WHERE sts_cd_id = 'ACTIVE_UUID'
UNION
SELECT *
FROM x
WHERE sts_cd_id = 'NEW_UUID'
) I
WHERE I.crt_utc > CURRENT_TIMESTAMP