Hi
I have a class *Transaction* which has an *Account* and this belongs to an *
User*.
In order to list all transactions of an account, I want to make a check if
the account belongs to the user which wants to access this list.
public class Transaction
>
> {
>
> public virtual int DataId { get; set; }
>
> public virtual string Description { get; set; }
>
> public virtual decimal Amount { get; set; }
>
> public virtual DateTime Date { get; set; }
>
> public virtual Boolean IsExecuted { get; set; }
>
> public virtual Category Category { get; set; }
>
> public virtual Account Account { get; set; }
>
> }
>
>
public class Account
>
> {
>
> public virtual int DataId { get; set; }
>
> public virtual string Name { get; set; }
>
> public virtual User User { get; set; }
>
> }
>
>
public class User
>
> {
>
> public virtual int DataId { get; set; }
>
> public virtual string Name { get; set; }
>
> }
>
>
My query is the following:
public IList<Transaction> GetAllTransactionsOfAccount(int userDataId, int
>> accountDataId, int count)
>
> {
>
> using (ISession session = NHibernateHelper.GetCurrentSession())
>
> {
>
> return session.CreateCriteria<Transaction>()
>
> *.Add(Restrictions.Eq("Account.User.DataId", userDataId))*
>
> .Add(Restrictions.Eq("Account.DataId", accountDataId))
>
> .AddOrder(Order.Desc("Date"))
>
> .SetMaxResults(count)
>
> .List<Transaction>();
>
> }
>
> }
>
>
The marked Criteria is not working.
could not resolve property: Account.User.DataId of: Entities.Transaction
Is there any possibility to achieve this result?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/7ffoM4iAO0wJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.