Hello,
How to use the Oracle function NVL in LINQ ?
Exemple :
SELECT *
FROM TABLE
WHERE Field = NVL(1020, UID)
LINQ
query.Where(t => t.Field == ??????);
Thanks
Citt_jr
Use NVL in LINQ
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
No .NET methods are translated into the NVL Oracle function. However, you can get the same result by using the null-coalescing operator ('??' in C#):
Please tell us if this helps.
Code: Select all
query.Where(t => t.Field == UID ?? 1020);
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
We will consider implementing the translation of the null-coalescing operator to the NVL function. However, we cannot provide any timeframe for this feature.
At the moment, you can use this function or hints manually via the ExecuteQuery generic method:
or add text WHERE conditions via the Dynamic Query library:
At the moment, you can use this function or hints manually via the ExecuteQuery generic method:
Code: Select all
var query = dataContext.ExecuteQuery(
"select field1, field2, ... from myTable where field1 = NVL(...)"
);
Code: Select all
query = query.Where("field1 = NVL(...)");