tags:

views:

33

answers:

2

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
+1  A: 

with a projection:

var result = ctx.Source.Where(...).Select(i => CostCentre == "" ? "Unknown" : CostCentre);

should give you a IQuerialable of strings.

Arthur
+1  A: 
Jacob Proffitt