Hi Alex, On Wed, May 18, 2011 at 9:04 PM, H.Alex <[email protected]> wrote: > or, even better, using this for IMessageSender :) > > public interface IMessageSender > { > IList<VoicemailMessage> SentMessages { get; } > }
that's a nice paradigm shift. :-) Anyway it's not so straightforward. Let me explain what I mean shifting a bit the focus of the thread. On the long term, each Employee/Friend will leave *a lot* of voice mail messages in the system. Let's suppose I have to check all the messages that the employee Giulio Petrucci left in the system from a certain date to another date (the VoiceMailMessage entity has a property LeftAt od type DateTime). So, having: DateTime from = ...; DateTime to = ...; EmployeeId myId = ...; ISession s = ...; in the first way, I'd have: var me = s.Get<Employee>(myId); var messages = s.Query<VoiceMailMessage>().Where(m => m.Sender == me).Where(m => m.LeftAt >= from && m.LeftAt <= to).ToList(); [code written on-the-fly :-P don't know it if compile/works at all] in the other way, I'd have: var messages = s.Get<Employee>(myId).FindAll(m => m.LeftAt >= from && m.LeftAt <= to).ToList(); [code written on-the-fly :-P don't know it if compile/works at all] My (new) question is: the IMessageSender.MessagesSent list is actually fetched when queried by the .FindAll()? Because fetching all the messages could be a bit "heavy". :-) Thanks in advance, Giulio -- -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
