【问题标题】:How to delete a post in Nhibernate?如何删除 Nhibernate 中的帖子?
【发布时间】:2010-05-02 20:28:13
【问题描述】:

我尝试删除 NHibernate 中的帖子,但没有任何反应。更新、选择和插入新项目工作正常,但是当我尝试删除时没有任何反应。

  IQuery query = session.CreateQuery("from Color where name like '%" + TextBox2.Text.Trim() + "%'");
        Color color = query.List<Color>()[0];
        session.Delete(color);

编辑: 我忘了调用flush方法。现在工作正常。像这样:

session.Flush(); 

【问题讨论】:

  • 您可以添加session.Flush() 作为您自己问题的答案并接受它。

标签: nhibernate


【解决方案1】:

session.Flush();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-15
    • 2010-09-23
    • 1970-01-01
    • 2015-03-09
    • 2021-03-01
    • 2019-09-28
    • 2019-12-01
    相关资源
    最近更新 更多