Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public T GetBusinessObject (lambda_criteria)
- Employee emp = BOC.GetBusinessObject( Employee.ID=123 )
- T GetBusinesObject<T>( Func<T, bool> predicate )
- {
- return this.FirstOrDefault( predicate );
- }
- T GetBusinessObject<T>(Predicate<T> constraint) where T : BO
- GetBusinessObject<Employee>( e => e.ID = 123 )
- BOC<Employee> boc = ...
- // checks exactly 1 match, throws if no match
- var emp = boc.Single(e => e.ID = 123);
- // checks at most 1 match, null if no match
- var emp = boc.SingleOrDefault(e => e.ID = 123);
- // checks at least one match, throws if no match
- var emp = boc.First(e => e.ID = 123);
- // returns first match, null if no match
- var emp = boc.FirstOrDefault(e => e.ID = 123);
Add Comment
Please, Sign In to add comment