Geeks With Blogs

News
Łukasz Kuryło's blog November 2010 Entries
Accessing Session object from custom handler

By default, when you want access to Session object from http handler you have beautiful exceptions thrown.

This is probably from performance reason. But there is very simple solution to fix it.

Everything to do is to implement a IRequiresSessionState marker interface.

Posted On Sunday, November 14, 2010 12:34 AM

Returning Count(*) with NHibernate HQL
I wrote in current project typical funcion to count the number of elements in db for specific criteria using NHibernate HQL: IQuery query = Session.CreateQuery(@" select count(t.ID) from Post p join p.Tags t where t.Name=:tagName and p.Blog.Name=:blogName ") .SetParameter("tagName", tagName) .SetParameter("blogName", blogName); int result=query.UniqueResult&l... I was very surpriced to see that I stuck with System.InvalidCastException: Specified cast is not valid. Solution for this was to ......

Posted On Tuesday, November 2, 2010 8:52 AM

Copyright © Łukasz Kuryło | Powered by: GeeksWithBlogs.net