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
Details: While trying to use dapper to fire SQL queries and get back results, I came across a rather weird situation. 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.
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. the property type is string and column in Oracle db's view is Long.
Let me know in case you need more details.
Look at dapper issue 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. Read Long to Varchar2 conversion.. and find similar topics on AskTom
fix the dapper :)
use ADO.NET instead