You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: context here is my injected DbContext instance
But when executing this I get SQL Error
Stack Trace
Exception: Microsoft.Data.SqlClient.SqlException
Message : 'STDistance' is not a recognized built-in function name.
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlCommand.InternalEndExecuteNonQuery(IAsyncResult asyncResult, Boolean isInternal, String endMethod)
at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryAsync(IAsyncResult asyncResult)
at Microsoft.Data.SqlClient.SqlCommand.<>c.<InternalExecuteNonQueryAsync>b__210_1(IAsyncResult result)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
at LinqToDB.Data.DataConnection.ExecuteNonQueryDataAsync(CancellationToken cancellationToken)
Which is correct, I can see ON (STDistance([Source].[Location]) < 10) given as the predicate in outputted query _(It should be [Target].[Location].STDistance([Source].[Location]) but using these operations from Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite in other more simpler queries behaves as expected
Just FYI I've managed to get around this for now by defining the following:
[Sql.Expression("{0}.STDistance({1})", ServerSideOnly =true)]publicstaticdoubleDistanceTo(thisPointp1,Pointp2)=>thrownew NotImplementedException("Method cannot be executed during runtime");
I was led to do this by #49 saying to open new if still existing
I've followed all steps in the above adding the following mappings:
Linq2Db Config
And I have the following code I'm trying to run:
Query
Note:
context
here is my injectedDbContext
instanceBut when executing this I get SQL Error
Stack Trace
Which is correct, I can see
ON (STDistance([Source].[Location]) < 10)
given as the predicate in outputted query _(It should be[Target].[Location].STDistance([Source].[Location])
but using these operations from Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite in other more simpler queries behaves as expected(I can see that issue #49 was having the exact same with another function at the end of the thread)
The text was updated successfully, but these errors were encountered: