Cannot convert int to string
Posted: Fri 25 Feb 2011 15:38
Have an entity with couple of properties
public string Suffix { get; set; }
public int Prefix { get; set; }
- Concatenate string.concat(Prefix, Suffix) - errored out
- Tried SqlFunctions.StringConvert() - errored out
- Also tried creating a partial class and still the same issue
concat error:
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
sqlfunctions error:
The specified method 'System.String StringConvert(System.Nullable`1[System.Double])' on the type 'System.Data.Objects.SqlClient.SqlFunctions' cannot be translated into a LINQ to Entities store expression.
In SQL Server, this works without any issues.
Any help is still appreciated
public string Suffix { get; set; }
public int Prefix { get; set; }
- Concatenate string.concat(Prefix, Suffix) - errored out
- Tried SqlFunctions.StringConvert() - errored out
- Also tried creating a partial class and still the same issue
concat error:
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
sqlfunctions error:
The specified method 'System.String StringConvert(System.Nullable`1[System.Double])' on the type 'System.Data.Objects.SqlClient.SqlFunctions' cannot be translated into a LINQ to Entities store expression.
In SQL Server, this works without any issues.
Any help is still appreciated