I have the following tables :
Customer(ID, Name)
Transaction(ID, CustomerID, Date)
The mapping objects for the tables are defined without objects, only primitive types :
Customer(int ID, string Name)
Transaction(int ID, string CustomerID, DateTime Date)
And I want to select all the customers and their last purchase date in ascending order. I tried using aliases and creating a join with customer Id and transaction's customer Id but I get an exception saying
could not resolve property: customer of: Transaction
Transaction transaction = null;
Customer customer = null;
session.QueryOver<Transaction>(() => transaction).
SelectList(list => list.
Select(() => customer.Name).
SelectGroup(() => transaction.CustomerId).
SelectMin(() => transaction.Date)).
JoinQueryOver(() => customer).Where(() => customer.Id == transaction.Id).
OrderBy(Projections.Min<Transaction>(trans => trans.Date)).Asc.
List<object[]>().
ToList();
I don't understand why it's trying to look for a customer property in transaction, the only case they togheter in a line is in the where clause. I probably didn't quite get the Join that well.
Can anybody shed some light on this exception?