Very nice! I implemented strongly typed delete in NH-3488
<https://nhibernate.jira.com/browse/NH-3488>, but the syntax was a bit
different:
session.Delete<Product>(x => x.Price > 100);
Do you have a pull request waiting to be issued?
RP
On Thursday, December 18, 2014 11:21:06 PM UTC, Gunnar Liljas wrote:
>
> So, now I have completed and old abandoned NH project, to create a Linq
> implementation of the bulk functionality. It's complete in the sense that
> all the unit tests from the HQL implementation passes with the Linq
> implementation as well, plus a couple more. Before I clean things up, I'd
> like you input on the syntax.
>
> Currently it works like this:
>
> Delete
>
> session.Query<Animal>()
> .Where(x=>x.Age>3)
> .DeleteAll();
>
> //all methods returns int (affected rows)
>
> Update
>
> session.Query<Animal>()
> .Where(x=>x.Age>3)
> .UpdateAll(x=>x
> .Set(y=>y.Name,"Peter")
> .Set(y=>y.Age,y=>y.Age+1)
> )
>
> Insert (i.e INSERT SELECT)
>
> session.Query<Animal>()
> .Where(x=>x.Age>3)
> .InsertInto(x=>new Human{
> Name=x.Name,
> Age=x.Name+10
> })
>
>
> The Delete method was first implemented as
> session.Delete<Animal>(x=>x.Age>3), but I added the IQueryable<T>.DeleteAll
> extension for consistency.
>
> I welcome any ideas on how this can be improved/changed.
>
> /G
>
--
---
You received this message because you are subscribed to the Google Groups
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.