How to delete a post in Nhibernate?
- by marko
I try to delete a post in NHibernate but nothing happens. Updating, selecting and inserting new items works fine but when I try to delete nothing happens.
IQuery query = session.CreateQuery("from Color where name like '%" + TextBox2.Text.Trim() + "%'");
Color color = query.List<Color>()[0];
session.Delete(color);
Edit:
I forgot to call the flush method. Now works fine. Like this:
session.Flush();