我看过这个看似相似的答案,但两种解决方案都没有帮助。 EF Function Import does not recognise columns returned by StoredProc
没有错误但是在实体上下文中,当我编辑函数以验证列是否正确时函数导入它指出当我单击“获取列信息”按钮时“所选存储过程或函数不返回列”。
我认为差异在于它是天蓝色的,它限制了它允许的sql。 sproc看起来像这样。以前我有一个联合所有与另一个结果集,但为了简化它我把它分成两个sprocs
CREATE PROCEDURE [dbo].[Pipeline_List_By_Geography]
(
@Latitude float,
@Longitude float,
@intRadiusKm int = 5
)
As
DECLARE @SearchPoint as geography
SET @SearchPoint = geography::Point(@Latitude, @Longitude, 4326)
SELECT [ID] as "Id", [LegalName] AS "OfficeName", [Address], [City]
, [PostalCode], [CountryCode], [Brand], [Latitude], [Longitude], [SRID],
([Point].STDistance(@SearchPoint)/1000) AS "distance",
[ProjectType], 'Pipeline' As "Source"
FROM TABLEA
WHERE [Point].STDistance(@SearchPoint) <= (@intRadiusKm * 1000)
GO
所以,这会返回一个结果集,所以我知道sproc的工作原理......它与EF和azure相互作用的方式是一些时髦的伏都教: - /
EXEC [dbo].[Pipeline_List_By_Geography] 32.783531, -96.796915, 50