Nhibernate添加查询选项 [英] Nhibernate add Option for queries

查看:89
本文介绍了Nhibernate添加查询选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Nhibernate生成的SQL中遇到了性能问题,如

I have recently had performance problem with Nhibernate generated SQL as described in

Nhibernate生成普通的sql查询而不是执行语句

我还找到了一个链接,描述了

I also found a link describing similar experience from the one and only Jeff Atwood at

http://legeronline.blogspot .ca/2009/03/evils-of-slow-paramaterized-query-plans.html

是否有人知道是否可以向Nhibernate添加优化未知"选项?

Does anyone know if there is anyway to add an "Optimize Uknown" option to Nhibernate?

推荐答案

  • 您可以考虑扩展MsSqlDialect或
  • 使用IConnectionProvider注入自己的commandwrapper,当调用ExecuteReader()时会添加提示
    • you could look into extending the MsSqlDialect or
    • implement IConnectionProvider to inject your own commandwrapper which adds the hint when ExecuteReader() is called
    • 这篇关于Nhibernate添加查询选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆