DomainObjects Class Library

Criteria Class

Use Criteria to specify the search conditions of a query. At runtime, DomainObjects converts a Criteria instance to the WHERE clause of a SQL statement. Each instance of a Criteria in a query generates a parenthesized set of constraints in a WHERE clause.

For a list of all members of this type, see Criteria Members.

System.Object
   Criteria
      Predicate

[Serializable]
[Serializable]
public class Criteria : IObjectModelExpression

Remarks

When used in conjunction with the DomainObjectGen.exe code-generation tool, this class defines compile-time-checked and Visual Studio IntelliSense-supported queries against a data source. When your schema changes and your Repository.xml is subsequently updated, DomainObjectGen.exe generates an updated set of field reference paths that can be used to define your search conditions.

Example

The following code sample demonstrates querying for an instance of Person in the DomainObjects unit test database where the field '_firstname' equals 'tom'. For the complete code example, see QueryTests.AddEqualTo().

Based on the criteria defined in the AddEqualTo test, at runtime DomainObjects generates and executes the following SELECT statement against the database:

SELECT
  A0.ID,
  A0.FIRSTNAME,
  A0.LASTNAME 
FROM PERSON A0 
WHERE A0.FIRSTNAME = 'tom'

Requirements

Namespace: DomainObjects.Facade.Command

Assembly: DomainObjects.Core (in DomainObjects.Core.dll)

See Also

Criteria Members | DomainObjects.Facade.Command Namespace