nHibernate批量大小不起作用
我在nHibernate中遇到了批量大小的问题(C# – VS 2012)。 我在集合和配置中设置了“batch-size”,但它不起作用。
using (var s = OpenSession()) { using (var t = s.BeginTransaction()) { Parent parent = s.CreateCriteria(typeof(Parent)).List().First(); Console.Write(parent.Children[0]); t.Commit(); } }
nHibernate profiler显示它一次性占用所有孩子(例如1000个孩子),但它应该只需要5个孩子。
Parent.hbm.xml:
Child.hbm.xml:
的hibernate.cfg.xml
NHibernate.Driver.SqlClientDriver Server=.;initial catalog=Lista6;Integrated Security=SSPI 5 true NHibernate.Dialect.MsSql2008Dialect 60 true 1, false 0, yes 'Y', no 'N' true
你有什么想法为什么批量大小不起作用?
你误解了batch-size
意味着什么。
这意味着它将同时阅读5个儿童系列 ,而不是它将加载该系列的5个元素。
另一方面, adonet.batch_size
意味着插入/更新/删除语句将以该大小的组发送,以便减少往返次数。
上述就是C#学习教程:nHibernate批量大小不起作用分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/988592.html