public HostDeposit GetByHostDepositById(long hostDepositId) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var linqMetaData = new LinqMetaData(adapter); var hostPayment = Queryable.FirstOrDefault <HostPaymentEntity>(linqMetaData.HostPayment.WithPath(prefetchPath => prefetchPath.Prefetch(path => path.Address).Prefetch(path => path.HostPaymentTransaction)).Where( hp => hp.HostPaymentId == hostDepositId && hp.IsDeposit)); if (hostPayment == null) { throw new ObjectNotFoundInPersistenceException <HostPayment>(hostDepositId); } var address = _addressRepository.GetAddress(hostPayment.MailingAddressId.Value); return(_hostDepositFactory.CreateHostDeposit(hostPayment, address)); } }
public virtual TSource FirstOrDefault <TSource>(IQueryable <TSource> source, Expression <Func <TSource, Boolean> > predicate) { return(Queryable.FirstOrDefault <TSource>(source, predicate)); }
public virtual TSource FirstOrDefault <TSource>(IQueryable <TSource> source) { return(Queryable.FirstOrDefault <TSource>(source)); }