我现在用的Devart EF-4提供了PostgreSQL的。
I am using the Devart EF-4 provider for PostgreSQL.
在我的数据库表之一,我有一个名为the_geom列这是PostGIS几何类型列抱着一个多边形。长话短说,PostGIS中使用它自己的二进制格式存储几何值,所以对于它在我的应用程序可用,我需要将其转换为驰名二进制(WKB),这是几何形状的规范二进制重新presentation 。这样就可以实现在标准的SQL很容易通过选择在
In one of my db tables, I have a column called the_geom which is a PostGis Geometry type column holding a polygon. Long story short, PostGis uses its own binary format to store geometry values, so for it to be usable in my application i need to convert it to Well-Known-Binary (WKB) which is a standardized binary representation of geometry. This can be achieved quite easy in standard SQL by selecting in with
select asbinary(the_geom) from mytable
最后一个问题是这样的: 我如何在实体框架,指定要使用的asbinary()函数来选择the_geom列?
The final question is this: How do I, in Entity Framework, specify to use the asbinary() function to select the_geom column?
还有一堆的,你可以的LINQ querys在 SqlFunctions
使用SQL Server功能的类 System.Data.Objects.SqlClient
命名空间。
There is a bunch of Sql Server functions that you can use in Linq querys in SqlFunctions
class in System.Data.Objects.SqlClient
namespace.
看做工一样,在为Postgre您的LINQ提供程序库,如果你不能找到添加一个计算列与 asbinary(the_geom)的值
和地图该列在EF。
Look for sth like that in your Linq Provider library for Postgre, and if you can't find add a computed column with the value of asbinary(the_geom)
and map that column in EF.
您甚至可以写事物一样,如果你看一下反编译code,
You may even could write sth like that if you look at the decompiled code,
public static class SqlFunctions
{
// Methods
[EdmFunction("SqlServer", "STR")]
public static string StringConvert(double? number)
{
}
}