Hi all,
FYI, using String.Contains(Char) in a LINQ query produces weird
results. The obvious solution, which I am doing, is to use
String.Contains(String) instead, but I'm posting this in case someone
else runs in to the same problem. It seems that it's comparing the
primary key of the table to the value passed in instead of the field
specified.
Thanks,
Don
// Use 'f' as a Char:
mas =
NHibernate.Linq.LinqExtensionMethods.Query<MailingAddress>(session).Where(ma
=> ma.Line1.Contains('f')).ToList();
/*
exec sp_executesql N'select mailingadd0_.MAILING_ADDRESS_ID as
MAILING1_1_, mailingadd0_.LINE_1 as LINE2_1_, mailingadd0_.LINE_2 as
LINE3_1_, mailingadd0_.CREATOR_ACCOUNT_ID as CREATOR4_1_,
mailingadd0_.OWNER_ACCOUNT_ID as OWNER5_1_ from MAILING_ADDRESS
mailingadd0_ where exists (select mailingadd0_.MAILING_ADDRESS_ID from
MAILING_ADDRESS mailingadd0_ where
mailingadd0_.MAILING_ADDRESS_ID=@p0)',N'@p0 int',@p0=102
*/
// Use "f" as a String:
mas =
NHibernate.Linq.LinqExtensionMethods.Query<MailingAddress>(session).Where(ma
=> ma.Line1.Contains("f")).ToList();
/*
exec sp_executesql N'select mailingadd0_.MAILING_ADDRESS_ID as
MAILING1_1_, mailingadd0_.LINE_1 as LINE2_1_, mailingadd0_.LINE_2 as
LINE3_1_, mailingadd0_.CREATOR_ACCOUNT_ID as CREATOR4_1_,
mailingadd0_.OWNER_ACCOUNT_ID as OWNER5_1_ from MAILING_ADDRESS
mailingadd0_ where mailingadd0_.LINE_1 like (''%''+@p0+''%'')',N'@p0
nvarchar(4000)',@p0=N'f'
*/
--
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.