public Merchant[] Execute(ISpaceProxy spaceProxy, ITransaction tx) { SqlQuery <Merchant> query = new SqlQuery <Merchant>("category = ?"); query.SetParameter(1, categoryType); return(spaceProxy.ReadMultiple <Merchant>(query, int.MaxValue)); }
private IEnumerable <Author> QueryForAuthorByBookTitle(ISpaceProxy spaceProxy) { var query = new SqlQuery <Author>("LastName=? and Book.Title=?"); query.SetParameter(1, "AuthorX"); query.SetParameter(2, "BookX"); Author[] authors = spaceProxy.ReadMultiple <Author>(query); return(authors); }
private IEnumerable <Author> QueryForAuthorByBookTitle(ISpaceProxy spaceProxy) { var authorQuery = new SqlQuery <Author>("LastName=? AND Books[*].Title=?"); authorQuery.SetParameter(1, "AuthorX"); authorQuery.SetParameter(2, "BookY"); var authors = spaceProxy.ReadMultiple <Author>(authorQuery); return(authors); }
private IEnumerable <Author> QueryForAuthorByBookTitle(ISpaceProxy spaceProxy) { var bookQuery = new SqlQuery <Book>("Title=?"); bookQuery.SetParameter(1, "BookX"); var books = spaceProxy.ReadMultiple <Book>(bookQuery); var authorIds = new StringBuilder(); foreach (var book in books) { authorIds.AppendFormat(",{0}", book.AuthorId); } var authorQueryCriteria = authorIds.ToString().TrimStart(','); var authorQuery = new SqlQuery <Author>(string.Format("LastName=? AND Id in ({0})", authorQueryCriteria)); authorQuery.SetParameter(1, "AuthorX"); var authors = spaceProxy.ReadMultiple <Author>(authorQuery); return(authors); }
private IEnumerable <Book> QueryForBooksByAuthor(ISpaceProxy spaceProxy) { var books = new List <Book>(); var authorQuery = new SqlQuery <Author>("LastName=?"); authorQuery.SetParameter(1, "AuthorX"); var authors = spaceProxy.ReadMultiple <Author>(authorQuery); foreach (var author in authors) { books.AddRange(author.Books); } return(books); }
private IEnumerable <Book> QueryForBooksByAuthor(ISpaceProxy spaceProxy) { var books = new HashSet <Book>(); var query = new SqlQuery <Author>("LastName=?"); query.SetParameter(1, "AuthorX"); Author[] authors = spaceProxy.ReadMultiple <Author>(query); foreach (Author author in authors) { books.Add(spaceProxy.ReadById <Book>(author.BookId)); } return(books); }
public HashSet <long?> Execute(ISpaceProxy spaceProxy, ITransaction tx) { SqlQuery <Payment> query = new SqlQuery <Payment>("merchantId = ? "); query.SetParameter(1, merchantId); Payment[] payments = spaceProxy.ReadMultiple <Payment>(query, int.MaxValue); HashSet <long?> userIds = new HashSet <long?>(); // Eliminate duplicate UserId if (payments != null) { for (int i = 0; i < payments.Length; i++) { userIds.Add(payments[i].UserId); } } return(userIds); }
public User[] findUsersByTemplate() { User user = new User(); user.Status = EAccountStatus.ACTIVE; return(proxy.ReadMultiple <User>(user)); }
// Return a collection of Merchants public Merchant[] findAllMerchants() { Merchant template = new Merchant(); return(Proxy.ReadMultiple <Merchant>(template)); }