Good advice :-) Thanks

On Feb 22, 2:20 pm, Diego Mijelshon <[email protected]> wrote:
> That's not hardcoding. You avoid the errors by writing tests for all your
> queries.
>
>    Diego
>
> 2010/2/22 Peter4922 <[email protected]>
>
>
>
> > Hi,
>
> > thanks for the reply.
>
> > Is there any good way to avoid having to hard code the class names
> > DownLoad and the property name DateTime ? How does one avoid errors
> > when changing the property names and the query stops working ?
>
> > Regards
>
> > Peter
>
> > On Feb 19, 6:08 pm, Fabio Maulo <[email protected]> wrote:
> > > 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]
> > > >  >
> > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup 
> > s.com>>
> > > > .
> > > > 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]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

-- 
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.

Reply via email to