这是我的查询
var selectDinnerByDistance = string.Format(
@"Select
u.ProfileImageUrl as ProfileImageUrl,
d.Starter as Starter,
d.Main as Main,
d.Dessert as Dessert,
d.Dry as DryDinner,
d.[Date] as EventDate,
l.GeoLoc.STDistance(geography::STGeomFromText('POINT({0} {1})', 4326)) as Distance
from dbo.Locations l
join Dinners d on d.LocationId = l.Id
join Users u on u.Id = d.UserId
Order by Distance asc
OFFSET {2} ROWS
FETCH NEXT {3} ROWS ONLY"
, lat, lng, skip, take);
var output = _session
.CreateSQLQuery(selectDinnerByDistance)
.SetResultTransformer(Transformers.AliasToBean<DinnerListItemDto>())
.List<DinnerListItemDto>();
我得到的例外是
Not all named parameters have been set: [':STGeomFromText']
该查询在管理工作室中运行良好。还有另一种方法我应该使用直接的 sql 查询来避免这个错误吗?
谢谢