What happens if you use ((short)500) in the expression?

/Oskar


2012/5/30 jlhunter <[email protected]>:
> 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/-/BItFX6A56RsJ.
> 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.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
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