As teh field can potentially result in multiple instances (it's not a pk nor a unique constraint)
I've added the fields as a unique contraint, the related JobEntity also has the corresponding method FetchUsingUCIdValidTo (IdValidTo being the name of my unique constraint, which is on the ID and ValidTo fields).
The problem is that I can't add a null value for one of the columns in the unique constraint through the generated method overloads since the method overloads only accept Int32 and DateTime params.
From SQL 2005 Books online ("about UNIQUE contraints"):
Also, unlike PRIMARY KEY constraints, UNIQUE constraints allow for the value NULL. However, as with any value participating in a UNIQUE constraint, only one null value is allowed per column.
I think this is the same problem craigmain ran into, my question is if there is an alternative for your suggestion above (Formulate your own predicate expression in FetchEntityUsingUniqueConstraint) for the SelfServicing template. The 'workaround' you suggest was what I had initially but it really felt like a workaround so I was looking for a cleaner solution. It wouldn't work in the constructor of an entity since I can't assign to "this", i.e.: this = new JobEntity().
Could you tell me if this problem is solved in the template set you're building specifically for 2.0 using nullable types, because basically my problem would be solved if I could somehow pass NULL to one of the parameters in the unique contraint...