I have my EntityFramework model(edml) hooked up with OracleClient. I am using LINQ queries on my Entity model object to access data. The problem I am facing is that when the data has an encoded character say "รค", my LINQ query result set shows it as a normal decoded string "a". I need to maintain the character encoding.
Here are the things that I have done so far and none of them have worked so far.
I have set the Unicode property as true as mentioned in the link below.
EntityFramework update or insert Chinese or non-English text
I tried setting CharSet=utf8 in my ConnectionString as mentioned in the below link and I end up getting the Error. "Unknown connection string parameter 'CharSet'". I tried all possible Combination (charset, CharSet etc). None worked
When I access the data using OracleDataAccess object instead of EntityFramework, I get the data as expected. The below sample gives me the correct data.
using (OracleConnection connection = new OracleConnection(ConfigurationManager.ConnectionStrings["connString"].ConnectionString))
{
connection.Open();
using (OracleCommand command = new OracleCommand(@"SELECT * FROM EMP", connection))
{
Console.WriteLine("Connectin Complete");
command.BindByName = true;
command.CommandType = CommandType.Text;
Console.WriteLine("Reading Data");
OracleDataReader dr = command.ExecuteReader();
// dr.Read();
DataTable dt = new DataTable();
dt.Load(dr);
for (int i = 0; i < dt.Rows.Count; i++)
{
StringBuilder sb = new StringBuilder();
for (int j = 0; j < dt.Rows[i].ItemArray.Count(); j++)
{
sb.Append(dt.Rows[i].ItemArray[j].ToString());
sb.Append("\t\t");
}
Console.WriteLine(sb.ToString());
}
Console.WriteLine("Displaying the Data");
Console.ReadLine();
}
}
All I want is to get the data as-is from DB from EF. Any help would make my life a lot easier.