I'm attempting to perform a left join of two tables. From the second table I only want to select the name. However, if the join couldn't find a corresponding item, I want to select a default string as name. My code:
var query = from order in _context.Orders
join project in _context.Projects on order.ProjectId equals project.Id
into orderjoin
from item in orderjoin.DefaultIfEmpty()
select
new ResultModel
{
ProjectName = item.Name ?? "deleted project",
ProjectId = order.ProjectId,
Origin = order.Origin,
Destination = order.Destination,
...
};
results in an ORA error:
System.Data.Entity.Core.EntityCommandExecutionException : An error occurred while executing the command definition. See the inner exception for details.
----> Oracle.ManagedDataAccess.Client.OracleException : ORA-12704: character set mismatch
I could ofcource remove the condition, iterate over the result and replace the null values, but I would prefer a cleaner solution. How can I avoid this error?