Showing posts with label flaw. Show all posts
Showing posts with label flaw. Show all posts

Wednesday, November 12, 2008

New Object Creation Flaw in LINQ to SQL

What was Microsoft thinking when they designed the code generator for LINQ-to-Sql objects. If I have the ability to reflect upon a database schema and determine the field attributes and can infer that a given field cannot be null… wouldn’t it make sense that when the automatic code generation is executes, a parameterized constructor was created REQUIRING that that non null attribute be provided ensuring that it IS NOT NULL! Without this any developer using a pre-defined class library or LINQ-to-Sql object may get run time errors notifying them that an object cannot be created because a value wasn't provided for a given attribute that is required. At least enforcing this through a constructor requires developers create the item correctly at design time. Just my two cents but it seems like a very large flaw to have just been overlooked and is very simple to implement.