I have to write linq to sql server between two tables,the related fields are in a different types. one is string(nvarchar) and the other is int.
here is my linq:
from je in a
join vP in b
on je.BaseRef equals SqlFunctions.StringConvert((decimal) vP.DocEntry)
the result of the linq in sql was:
SELECT
[Extent1].[Account] AS [Account]
FROM [dbo].[a] AS [Extent1]
JOIN [dbo].[b] AS [Extent2] ON ([Extent1].[BaseRef] = (STR( CAST( [Extent2].[DocEntry] AS float)))) OR (([Extent1].[BaseRef] IS NULL) AND (STR( CAST( [Extent2].[DocEntry] AS float)) IS NULL))
that query return null because sql can not compare varchar and nvarchar.
linq to entity translate sqlfunction.stringFormat to str('') and not to convert(nvarchar,'').
how can I convert to nvarchar?