I have the following T-SQL that replaces blank values with '[Unknown]'. How can I achieve this in a LINQ to EF query?
select distinct case when CostCentre = '' then '[Unknown]' else CostCentre end as CostCentre
I have the following T-SQL that replaces blank values with '[Unknown]'. How can I achieve this in a LINQ to EF query?
select distinct case when CostCentre = '' then '[Unknown]' else CostCentre end as CostCentre
with a projection:
var result = ctx.Source.Where(...).Select(i => CostCentre == "" ? "Unknown" : CostCentre);
should give you a IQuerialable of strings.