Sunday, July 19, 2009

Do you know about LINQ that.. ?

Do you know about LINQ to SQL that attribute is more important than value? What is it mean? My friend have found interesting relation. He had written LINQ to SQL where he checked a column value to null but he was disappointed - it wasn't worked if it was need. He had null values in set but LINQ code didn't see they (He had written simple test code with foreach - it worked). After some investigate he has found that trouble in mapped data. Particular property was marked ColumnAttribute with set CanBeNull property false. So LINQ implicitly optimizes him code regards attribute's value (skips the check to null).
PS: It shows that we should be careful to small thing.. because small things can implicitly brings a big and strange problems.

No comments: