The exact same. It passes it as Int32. I can get it to pass Int16 by making 
the type in the class int, but keeping the mapping type in the XML as 
short, but then I get a "Specified cast is not valid." error.

On Wednesday, May 30, 2012 1:24:12 AM UTC-4, Oskar Berggren wrote:
>
> What happens if you use ((short)500) in the expression? 
>
> /Oskar 
>
>
> 2012/5/30 jlhunter
> > I can't figure out how to get NHibernate to map to Int16. 
> > 
> > In the class, public virtual Int16 ClientId { get; set; } 
> > In the XML, name="ClientId" column="clnt_id" type="short" 
> > 
> > It works when I use: 
> > var member = session.CreateCriteria<Member>() 
> >     .Add(Restrictions.Eq("ClientId", 500)) 
> >     .Add(Restrictions.Eq("MemberId", 45629)) 
> >     .List<Member>(); 
> > 
> > but not: 
> > var member = session.Query<Member>().Where(x => x.ClientId == 500 && 
> > x.MemberId == 45629).ToList(); 
> > 
> > The latter passes in Int32 for ClientId, not Int16. This causes issues 
> as 
> > the column type is smallint (it takes about 40 seconds longer when 
> passing 
> > in Int32, don't have a full grasp of what's happening). 
> > 
> > I'm not sure how to map LINQ to use Int16. 
> > 
> > Thanks 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/rWZC4gUQIOgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to