Beispiel #1
0
 public IList <CustomerCardModel> GetUserCards(IdentityQuery <Guid> userId)
 {
     EnsureIsValid(userId);
     try
     {
         var userCards = _deps.UserCards.Project <CustomerCardModel>(userId.ToDbQuery <UserCard>());
         return(userCards);
     }
     catch (Exception ex)
     {
         throw new ServiceException("Cannot get user cards.", ex);
     }
 }
Beispiel #2
0
        public void Can_Do_IdentityQuery_WithIdSelector()
        {
            var query   = new IdentityQuery <string>("Ford");
            var dbQuery = query.ToDbQuery <Car, string>(x => x.Make);

            var cars = Cars.AsQueryable().Query(dbQuery);

            Assert.IsNotNull(cars);
            var expected = Cars.Where(x => x.Make == "Ford");
            var actual   = cars;

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Beispiel #3
0
        public void Can_Do_IdentityQuery_WithIdSelector()
        {
            var query = new IdentityQuery<string>("Ford");
            var dbQuery = query.ToDbQuery<Car, string>(x => x.Make);

            var cars = Cars.AsQueryable().Query(dbQuery);

            Assert.IsNotNull(cars);
            var expected = Cars.Where(x => x.Make == "Ford");
            var actual = cars;
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Beispiel #4
0
 public IList<CustomerCardModel> GetUserCards(IdentityQuery<Guid> userId)
 {
     EnsureIsValid(userId);
     try
     {
         var userCards = _deps.UserCards.Project<CustomerCardModel>(userId.ToDbQuery<UserCard>());
         return userCards;
     }
     catch (Exception ex)
     {
         throw new ServiceException("Cannot get user cards.", ex);
     }
 }