我正在将遗留的冷融合应用程序转换为ASP.NET核心。该应用程序是非常数据密集型的,而且冷融合代码利用了嵌入式SQL查询。我需要将一些冷融合查询转换为.NET查询表达式。例如,以下是一个典型的冷融合查询:
SELECT
s2.CriteriaID, s2.Response, s2.NA, s2.Status, s2.resubStatus, s2.staffDetermination, s2.resubStaffDetermination,
c.CriteriaDesc<cfif getAgency.agencyType NEQ "N">Short</cfif> criteriaDesc, ' ' long_desc
FROM tblASLStep2 s2
left outer join tblTableOfContentCriteria c on c.CriteriaNo = s2.criteriaID and c.meetingID = s2.meetingDate
where
s2.AgencyID = #session.AgencyID#
and s2.MeetingDate=#session.MeetingDate#
and (
(s2.response is not null and ltrim(cast(s2.response as nvarchar)) <> '')
or exists (
SELECT 1
FROM tblASLStep2_narratives n
WHERE
n.AgencyID = '#session.AgencyID#'
and n.CriteriaID = s2.criteriaID
and n.MeetingDate = #session.MeetingDate#
and n.narrativeType = 'R'
and n.response is not null
)
)
<cfif session.agencyType neq "F">
order by replace(replace(s2.CriteriaID, 'ix', 'viiii'), 'Agency Narrative', 1)
<cfelse>
and s2.criteriaID not like 'SEC5%'
union all
</cfif>
我可以得到'from‘和SELECT,但是左外部连接和条件语句部分会让我陷入循环。假设表和所有其他变量都存在,那么将其转换为.NET查询表达式的最佳方法是什么?
发布于 2019-12-11 16:11:32
如果可以运行旧版系统,启动SQL Server事件探查器并从事件探查器运行应用程序,则可以捕获发送到数据库的查询。
https://stackoverflow.com/questions/59273264
复制相似问题