使用nhibernate批量删除

#if DEBUG
            ///此段代码为了修正上一个版本的产生的废旧数据(仅在调试时为本地与服务器上程序兼容) by 唐敬波 2008/08/12
            string deletesql = "delete from dbo.B2bEcom_HtmlModuleGroup where id not in (select distinct(Groupid) from dbo.B2bEcom_HtmlModule)";
            NHibernate.SqlCommand.SqlString deleteString = new NHibernate.SqlCommand.SqlString(deletesql);
            NHibernate.SqlTypes.SqlType[] Types = new NHibernate.SqlTypes.SqlType[] { };
            IDbCommand deleteComand = DataAccess.NHibernateSession.SessionFactory.ConnectionProvider.Driver.GenerateCommand(CommandType.Text, deleteString, Types);
            IDbConnection con = DataAccess.NHibernateSession.SessionFactory.ConnectionProvider.GetConnection();
            deleteComand.Connection = con;
            int t = deleteComand.ExecuteNonQuery();
#endif
原文地址:https://www.cnblogs.com/68681395/p/1266412.html