Problem with default value with empty result
Posted: Thu 21 Jun 2012 16:16
And another bug in LinqConnect 4.x (tested with dotConnect for Mysql 7.0.17):
There is the following exception if a result set is empty.
(With LinqConnect 3.x the result was correctly set to default value 0.)
Message: Object reference not set to an instance of an object.
Stacktrace:
at Devart.Data.Linq.Engine.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at ...
Code: Select all
(from u in DB.Users where u.Id == -1 select u.Id).FirstOrDefault();
(With LinqConnect 3.x the result was correctly set to default value 0.)
Message: Object reference not set to an instance of an object.
Stacktrace:
at Devart.Data.Linq.Engine.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at ...