10.2 BPM SqlFunctions.StringConvert missing reference

Hello, we’re preparing to upgrade from 10.1.500 to 10.2.100 and I’m having trouble with a couple of our BPMs. In 10.1.500 we would use System.Data.Objects.SqlClient.SqlFunctions.StringConvert() but the System.Data.Entity this appears to be missing in 10.2. How can I bring this, or should I do this a different way?

UD12 = (from uRow in Db.UD12
where uRow.Company == ttLaborDtlRow.Company
&& uRow.Key1 == ttLaborDtlRow.JobNum
&& uRow.Key2 == System.Data.Objects.SqlClient.SqlFunctions.StringConvert((decimal)asm).Trim()
&& uRow.Key3 == System.Data.Objects.SqlClient.SqlFunctions.StringConvert((decimal)opr).Trim()
&& uRow.Key4 == opcode
select uRow).FirstOrDefault();

I tried just doing a straight ((decimal)opr).ToString(“F0”).Trim() but that throws a ‘NotSupportException’ exception “LINQ to Entities does not recognize the method ‘System.String ToString(System.String)’ method, and this method cannot be translated into a store expression.”

Did you find a solution for this issue?

I think in Epicor 10.2 they upgraded to Entity Framework 6+ I believe the change is a EF issue and the new namespaces to use would be I believe:

System.Data.Entity.SqlServer.SqlFunctions // StringConvert, DateDiff...
System.Data.Entity.DbFunctions // For EF Functions like AddDays or TruncateTime

2018-06-12_1608

3 Likes

Thanks!

1 Like