session.CreateQuery("delete from DownLoad d where d.DateTime >
:fromDate").SetDateTime("fromDate", fromDateTime).ExecuteUpdate();2010/2/19 Peter4922 <[email protected]> > Hi, > > what is the recommended way to delete multiple records that have not > previously been read from the database using CreateCriteria ? > > This is what I do: > > //first get all the downloads with DateTime >= fromDateTime. > IList<Download> downloads = session > .CreateCriteria(typeof(Download)) > .Add(Restrictions.Gt("DateTime", fromDateTime)) //DateTime > > fromDateTime. > .List<Download>(); > > //now delete the downloads > foreach (Download download in downloads) > { > session.Delete(download); > } > > Is there any way using CreateCriteria to do this in one call. Is > session.Delete("from Download d where d.DateTime >"+fromDateTime) the > only way ? > > Kind regards > Peter > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- 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.
