I have a "TeamEntity" that owns a collection of "TeamDepartmentEntity" which is a type two slowly changing dimension linking the Team and Department Entities.
The process I'm doing is to assign a team to a new Department. This involves finding the current TeamDepartmentEntity and setting the end date to "Yesterday" and adding a new TeamDepartment entity that is valid from today.
I am updating the Team entity and saving recursively when I get the error. The TeamEntity is pretty simple with a TeamId and a TeamName. The TeamDepartment is also pretty simple with TeamId, DepartmentId, StartDate and EndDate. The Department Entity has DepartmentId, DepartmentName.
It's nearly certain that I'm not setting something I should, however the question is centered around how can I find out what it is. I can look at the table in the database and ascertain the nullable columns etc... I can reflect the entities and find out what is set to what, but there are many many properties that I'd have to check. The exception is generated by LLBLGen so clearly at the point it happens the framework knows the name of the field it's having a problem with. How can I tell?
I should add, the unhandled exception can be worked around by deleting the relevant entities before refreshing the schema. That way, it never has the matching problem and doesn't throw. If I get a chance to reproduce it reliably I'll post it on the forum.