In order to have constancy in the instantiation of domain classes, but without interfering with the default constructor (the LINQ to SQL requires), add a static create method to all domain classes that get directly instanciated.
This method, unlike the constructor, can have required parameters. It should also perform tasks like creating the id, and making sure collections aren't null.
In order to have constancy in the instantiation of domain classes, but without interfering with the default constructor (the LINQ to SQL requires), add a static create method to all domain classes that get directly instanciated.
This method, unlike the constructor, can have required parameters. It should also perform tasks like creating the id, and making sure collections aren't null.