开发者

How to delete a post in Nhibernate?

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.Lis开发者_JAVA技巧t<Color>()[0];
        session.Delete(color);

Edit: I forgot to call the flush method. Now works fine. Like this:

session.Flush(); 


session.Flush();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜