I needed to delete a bunch of objects based on some parameters of those objects. It fairly obvious that one of the Delete overloads on ISession would work, but a couple of things throw me. First you need a full select query, not too hard to figure out. But second, where are IType’s defined? In NHibernateUtil (thanks to this). Anyway, here is some sample code. I’m guessing there might be a more efficient way, but this should work for most cases.

session.Delete(“select b from Bar as b where b.Instrument = :instrument and b.BarMinutes = :barMinutes”,
new object[] {instrument, barMinutes},
new IType[]
NHibernateUtil.Entity(typeof (Instrument)),
NHibernateUtil.Enum(typeof (BarMinutes))