【发布时间】:2020-04-21 16:01:40
【问题描述】:
我正在使用下面的迁移脚本来查询带有 EF 核心的 postgreSQL,对于列名和表名,我需要用这个符号 " " 括起来。
根据上述条件,我正在编写如下脚本,有什么方法可以逃避与+ 符号的串联
migrationBuilder.Sql("UPDATE " + "\"" + "LibraryPipePlantTypes" + "\"" + " SET " + "\"" + "MasterSectionName" + "\"" + " = "+ "'" + "Library Pipe Plant Type" + "'" + " WHERE" + "\"" + "MasterSectionName" + "\"" + " = " + "'" + "Library Hydronic Plant Type" + "'");
非常感谢。
【问题讨论】:
-
你试图用转义字符写出字符串,但没有连接?喜欢
"UPDATE \"LibraryPipePlantTypes\" SET"?其他关于 SO 的讨论和示例发现 here。