Hello I have one Class named Notifications which is a child class for the User.
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public ICollection<UserNotification> UserNotifications { get; set; }
}
public class Notification
{
public int Id { get; set; }
public ICollection<UserNotification> UserNotifications { get; set; }
public string Title { get; set; }
public string Message { get; set; }
public bool IsRead { get; set; }
public DateTime CreatedDate { get; set; }
}
public class UserNotification
{
public User User { get; set; }
public Notification Notification { get; set; }
}
Now I want to get the User By ID which will bring all the notifications for the current user.
var user = NhSession.Get<User>(userId);
But I don't want to get all the notifications. I just want to get the user with unread notifications and just want to get top 5 (Latest) notifications
for the user.
I tried to achieve that by joinQueryOver but I was not able to do that. Can anyone please suggest to get this working.