开发者

dialect problem in nhibernate

开发者 https://www.devze.com 2023-02-04 09:31 出处:网络
Hi I\'m trying to do this simple query in nhibernate but I keep getting the following error. results = (from purchase in _session.Query<Purchase>()

Hi I'm trying to do this simple query in nhibernate but I keep getting the following error.

            results = (from purchase in _session.Query<Purchase>()
                       group purchase by purchase.symbol into purchases
           开发者_如何学运维            select purchases.Sum(p => p.shares)).ToList();         

error is "Dialect does not support DbType.Double Parameter name: typecode"

purchase.shares is a double type but I don't understand why it doesn't add up.

Thanks


HI I think nhibernate is trying to execute the query in the db. is that what you really want. im nt sure if it is failing cos of that. You can probably look at the sql code generated using Nhibernate profiler, run this against ur db and see wat the prob is.

My suggestion would be to try the following

results = (from purchase in _session.Query<Purchase>().ToList()
                   group purchase by purchase.symbol into purchases
                   select purchases.Sum(p => p.shares)).ToList(); 

hope that helps


You need to use MySQL5Dialect instead of MySQLDialect.

0

精彩评论

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