IObjectSpace.FindObject<ObjectType>(CriteriaOperator) Method

Searches for the first object of the type designated by the specified generic type parameter, matching the specified criteria. The search takes uncommitted changes into account .

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

ObjectType FindObject<ObjectType>(
    CriteriaOperator criteria
)
Function FindObject(Of ObjectType)(
    criteria As CriteriaOperator
) As ObjectType

Parameters

Type Name Description
CriteriaOperator criteria

A CriteriaOperator descendant which is the criteria for matching persistent objects.

Returns

Type Description
ObjectType

An object which is the first persistent object which matches the specified criteria.

Type Parameters

Name Description
ObjectType

Remarks

Below is an example of using the FindObject<ObjectType> method. Here, objectSpace is the Object Space instance which can be accessed as described in the Ways to Implement Business Logic topic.

Contact contact = ObjectSpace.FindObject(
    typeof(Contact), CriteriaOperator.Parse("Name='Michael Suyama'"));

When implementing the IObjectSpace interface in the BaseObjectSpace class's descendant, you don't have to implement the FindObject<ObjectType> method. The BaseObjectSpace class' FintObject<ObjectType>(CriteriaOperator criteria) method invokes a public virtual FindObject(Type objectType, CriteriaOperator criteria, Boolean inTransaction) method passing true as the inTransaction parameter. So, to implement an object search, override the public virtual BaseObjectSpace.FindObject method.

See Also