System.NotSupportedException System.Text.RegularExpressions.Match Match(System.String)
抛异常了。。。。
原来的两种写法:
- Regex r = new Regex(@"[\u4e00-\u9fa5]");
- customerInfo = customerInfo.Where(x => r.Match(x.UserName).Success && r.Match(x.Address).Success);
- customerInfo = customerInfo.Where(x => r.IsMatch(x.UserName) && r.IsMatch(x.Address));
复制代码
都抛异常了,解决办法如下:
最后生成的sql语句,如下:
exec sp_executesql N'select cast(count(*) as INT) as col_0_0_ from dbo.CustomerInfo customerin0_ left outer join dbo.Organization organizati1_ on customerin0_.OrganizationId=organizati1_.Id where (organizati1_.LevelCode like (@p0+''%'')) and (customerin0_.userName like @p1) and (customerin0_.address like @p2)',N'@p0 nvarchar(4000),@p1 nvarchar(4000),@p2 nvarchar(4000)',@p0=N'00',@p1=N'%[吖-座]%',@p2=N'%[吖-座]%'
正常!!!!
|