[英]Unable to get Long type of data using Dapper
The problem: I am unable to retrieve a column of type Long in an Oracle DB source and set it to a string property in a class in .Net 问题:我无法在Oracle DB源代码中检索类型为Long的列并将其设置为.Net中类的字符串属性
Details: While trying to use dapper to fire SQL queries and get back results, I came across a rather weird situation. 详细信息:在尝试使用dapper触发SQL查询并获取结果时,我遇到了一个很奇怪的情况。 I cannot share the actual class details, but here is a sample. 我无法分享实际的课程详细信息,但这是一个示例。 I have a class: 我有一堂课:
public class MyClass
{
public string VeryLongMessage { get; set; }
}
I fire a dapper query as shown below: 我触发一个精简查询,如下所示:
using (var con = ConnectionUtility.GetConnection("MyConnectionString"))
{
var result = con.QueryAsync<MyClass>("SELECT VeryLongMessage FROM MyView");
}
But when I check the value in result, I get a null value inside result's VeryLongMessage property. 但是当我检查结果中的值时,我在结果的VeryLongMessage属性中得到一个空值。
Has anyone else seen such an issue? 还有其他人看到过这样的问题吗? Any thoughts or suggestions? 有什么想法或建议吗?
Things I have verified: The column name of my dapper query and the property both match. 我已验证的内容: dapper查询的列名和属性都匹配。 the property type is string and column in Oracle db's view is Long. 属性类型是字符串,Oracle数据库视图中的列是Long。
Let me know in case you need more details. 如果您需要更多详细信息,请告诉我。
Look at dapper issue 173 看看dapper问题173
Unfortunately, it seems there are four indirect ways: 不幸的是,似乎有四种间接方法:
fix database (in your case you cannot) 修复数据库(您无法修复)
add additional stored finction to fetch LONG as CLOB. 添加其他存储的函数以将LONG作为CLOB获取。 Read Long to Varchar2 conversion.. and find similar topics on AskTom 阅读Long到Varchar2的转换..并在AskTom上找到类似的主题
fix the dapper :) 修复dapper :)
use ADO.NET instead 改用ADO.NET
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.