I'd migrated my entity 6.0 project from SQL Server to PostGreSQL. With SQL Server, these kind of convertion on my queries used to work properlly
Module.cs
return (
from m in objDB.Modules
orderby m.ID
select new
{
ID = m.ID,
Name = m.Name,
Status = DB_Function.Convert.ToInt32( m.Status )
}
);
PS: Status is a boolean type
DB_Function.cs
[System.Data.Entity.DbFunctionAttribute( "Business.Database", "ToInt32" )]
public static Int32 ToInt32( Boolean Val )
{
return System.Convert.ToInt32( Val );
}
However, when I migrated to PostgreSQL (and therefore changed my EDMX), these kind of conversion don't execute anymore:
The specified method 'Int32 ToInt32(Boolean)' on the type 'DB_Function+Convert' cannot be translated into a LINQ to Entities store expression.
This error is related with PostGre (like int4 and not int32) or I'm missing something?
Thanks in advance.