EF query to Oracle throwing "ORA-12704: character set mismatch"
I ended up getting the author of this (ODP.Net Managed Driver - ORA-12704: character set mismatch in generated code) to update the question, he posted a workaround using an interceptor, I'll go a bit more detail here...
First, I decorated my DBContext to load a configuration. you can skip this and just add to your configuration if you have one:
[DbConfigurationType(typeof(MyDbConfiguration))]public partial class MyContext : DbContext
Create the config class:
public class MyDbConfiguration : DbConfiguration{ public MyDbConfiguration() { this.AddInterceptor(new NVarcharInterceptor()); //add this line to existing config. }}
Next, create the interceptor:
public class NVarcharInterceptor : IDbCommandInterceptor{ public void NonQueryExecuted(DbCommand command, DbCommandInterceptionContext<int> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); } public void NonQueryExecuting(DbCommand command, DbCommandInterceptionContext<int> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); } public void ReaderExecuted(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); } public void ReaderExecuting(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); } public void ScalarExecuted(DbCommand command, DbCommandInterceptionContext<object> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); } public void ScalarExecuting(DbCommand command, DbCommandInterceptionContext<object> interceptionContext) { if (command != null && !string.IsNullOrWhiteSpace(command.CommandText)) command.CommandText = command.CommandText.Replace("N''", "''"); }}