Ala*_*yne 1 postgresql stored-procedures npgsql dapper
来自 NuGet,我正在使用
...\packages\Npgsql.2.2.5\lib\net45\Npgsql.dll
...\packages\Dapper.1.42\lib\net45\Dapper.dll
在 PostgreSQL 中调用存储过程时,我需要将过程名称的大小写保留为
var x = cnn.Query<icd9>("GetDxLibrary", commandType: CommandType.StoredProcedure);
Run Code Online (Sandbox Code Playgroud)
我收到运行时错误:
Npgsql.dll 中发生“Npgsql.NpgsqlException”类型的未处理异常
附加信息:错误:42883:函数 getdxlibrary() 不存在。
如果 PostgreSQL 中的函数重命名为getdxlibrary()
,一切顺利。
如何在 Dapper 中调用大小写混合名称的过程?
TIA
只需在函数名称周围添加引号即可:
var x = cnn.Query<icd9>("\"GetDxLibrary\"", commandType: CommandType.StoredProcedure);
PostgreSQL 会自动将所有非引号标识符转为小写,因此当您发送 GetDxLibrary 时,它实际上会看到 getdxlibrary。
归档时间: |
|
查看次数: |
613 次 |
最近记录: |