Click or drag to resize

ObjectTransactionFindFirstOrDefaultTObject Method (ExpressionFuncTObject, Boolean, FuncTObject, Boolean)

Searches through both committed and uncommitted objects for a single object, matching the predicate. Returns null if not found.

Namespace:  Aloe.SystemFrameworks.Domain
Assembly:  Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntax
public TObject FindFirstOrDefault<TObject>(
	Expression<Func<TObject, bool>> predicate,
	Func<TObject, bool> compiledPredicate = null
)
where TObject : DomainObject

Parameters

predicate
Type: System.Linq.ExpressionsExpressionFuncTObject, Boolean
The predicate to match.
compiledPredicate (Optional)
Type: SystemFuncTObject, Boolean
The compiled predicate. Should be the same predicate, but in compiled form. If not specified, the compilation occurs in runtime.

Type Parameters

TObject
The type of the object to enumerate.

Return Value

Type: TObject
The found object or null.
Remarks
Because it knows, that it has to find only a single object, the method searches first locally and queries the data source only if no object is found locally.
See Also