I have a User entity that has a collection of Tickets. Each ticket
has a collection of TicketNotes. When I run a query to get open
tickets associated with the user, it's fetching every note even though
I'm not accessing that property:
public Ticket[] OpenTickets
{
get
{
return Ticket.FindAll(
new ICriterion[]
{
Restrictions.Eq("AssignedCSR", this), //Associated
with this user
Restrictions.Not( //
Any ticket that's not scheduled or completed
Restrictions.Disjunction().Add(
Restrictions.Eq("Status",
TicketStatus.Completed)).Add(
Restrictions.Eq("Status",
TicketStatus.Scheduled))
)
}
);
}
}
Inside the ticket class I have this:
private IList<TicketNote> _ticketNotes;
[HasMany(typeof(TicketNote),Lazy=true)]
public IList<TicketNote> TicketNotes
{
get
{
if(_ticketNotes==null){_ticketNotes = new List<TicketNote>();}
return _ticketNotes;
}
set { _ticketNotes = value; }
}
So even though TicketNote is set so Lazy=true, and I'm not using the
TicketNote property in for this, it's still running "SELECT ... FROM
TicketNote..." for each open ticket.
What could I be missing?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---