LINQ Dynamic Expression API, predicate with DBNull.Value comparison -
itemprop = "text">
I have an issue using the dynamic expression API. I can not compare a DataTable field against DBNull.Value. The API should be able to support "static area or fixed asset access. Any public area or property can be used." However the following question has been given:
var whatever = table1.AsEnumerable (). Add (table2.AsEnumerable (), (x) => x.Field & lt; int & gt; ; ("Table1_ID"), (Y) => y.Field & lt; int> ("Table2_ID"), (x, y) => New {x, y}). Exogenable . Where ("x [\" NullableIntColumnName \ "] == DBNull.Value"); I get an error: "A property or field is present in 'DBibul' type '& lt;> f__AnonymousType0` 2" " to get around this For? I can not use the presentation. The field ("NullableIntColumnName") has been passed in the string, where the method is either BTW, or otherwise I would be able to compare DBNull.Value with the tap instead.
OK, I finally got it. CptScarlet was almost.
var value = New object [] {DBNull.Value}; .... (Where "[[\" NullableIntColumnName \ "] == @ 0", value);
or
. ("X [\" NullableIntColumnName \ "] == @ 0", DBNull.Value);
Comments
Post a Comment