实体框架6和地理数据ST包含

时间:2019-06-12 16:36:14

标签: sql-server entity-framework linq geospatial sqlgeography

我已经添加了java.sql.SQLException: ORA-20999: Error in WF_STOP: ORA-20023: Workflow is not running. ORA-06512: vid "ODMRSYS.ODMR_INTERNAL_UTIL", rad 1584 ORA-06512: vid "ODMRSYS.ODMR_WORKFLOW", rad 2363 ORA-06512: vid "ODMRSYS.ODMR_WORKFLOW", rad 2431 ORA-06512: vid rad 1 at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494) at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:223) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:56) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:907) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780) at oracle.jdbc.driver.T4CCallableStatement.executeInternal(T4CCallableStatement.java:1300) at oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3865) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3845) at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:4253) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061) at oracle.jdbc.proxy.oracle$1dbtools$1raptor$1proxy$1driver$1oracle$1RaptorProxyOJDBCStatement$2oracle$1jdbc$1internal$1OracleCallableStatement$$$Proxy.executeUpdate(Unknown Source) at oracle.dmt.dataminer.core.model.generated.server.OdmrWorkflow.wfStop(Unknown Source) at oracle.dmt.dataminer.runner.RunManager$CancelWorkflow.doInBackground(RunManager.java:505) at javax.swing.SwingWorker$1.call(SwingWorker.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at javax.swing.SwingWorker.run(SwingWorker.java:334) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: Error : 20999, Position : 0, Sql = BEGIN ODMRSYS."ODMR_WORKFLOW".WF_STOP(:1 ); END;, OriginalSql = BEGIN ODMRSYS."ODMR_WORKFLOW".WF_STOP(:1 ); END;, Error Msg = ORA-20999: Error in WF_STOP: ORA-20023: Workflow is not running. ORA-06512: vid "ODMRSYS.ODMR_INTERNAL_UTIL", rad 1584 ORA-06512: vid "ODMRSYS.ODMR_WORKFLOW", rad 2363 ORA-06512: vid "ODMRSYS.ODMR_WORKFLOW", rad 2431 ORA-06512: vid rad 1 at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498) ... 24 more 来启用Entity Framework中的地理和几何类型,但是我看不到任何等效于Microsoft.SqlServer.Types的功能。

我需要进行查询以检索包含点的地理位置

在SQL中,我这样写:

STContains()

在LINQ中,我希望有类似的东西

SELECT adm1code, adm1name 
FROM Adm2GeoBoundaries
WHERE Coords.STContains(geography::Parse('POINT(-121.703796 46.893985)'));

但是using (GeoEntities db = new GeoEntities ()) { DbGeography location = DbGeography.FromText("POINT(-121.703796 46.893985)"); var admin = from a in db.Adm2GeoBoundaries where a.Coords.STContains(location) select a; } 会引发错误

  

STContains方法不存在

1 个答案:

答案 0 :(得分:0)

根据EF6 Source Code的源代码,STContains似乎在EF6中实现为包含。

https://github.com/aspnet/EntityFramework6/blob/master/src/EntityFramework.SqlServer/SqlSpatialServices.cs

enter image description here

看看SqlTypesAssembly.cs,您应该可以看到它应该调用STContains方法。

enter image description here