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
Syntaxpublic TObject FindFirstOrDefault<TObject>(
Expression<Func<TObject, bool>> predicate,
Func<TObject, bool> compiledPredicate = null
)
where TObject : DomainObject
Public Function FindFirstOrDefault(Of TObject As DomainObject) (
predicate As Expression(Of Func(Of TObject, Boolean)),
Optional compiledPredicate As Func(Of TObject, Boolean) = Nothing
) As TObject
public:
generic<typename TObject>
where TObject : DomainObject
TObject FindFirstOrDefault(
Expression<Func<TObject, bool>^>^ predicate,
Func<TObject, bool>^ compiledPredicate = nullptr
)
member FindFirstOrDefault :
predicate : Expression<Func<'TObject, bool>> *
?compiledPredicate : Func<'TObject, bool>
(* Defaults:
let _compiledPredicate = defaultArg compiledPredicate null
*)
-> 'TObject when '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