This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I've got a case where data in my model has gone bad - but the error message I get back from LS could be a lot more useful. I have EntityA which is many-one with EntityB. EntityB is many-one with EntityC. We are using soft deletes. I am querying EntityA using a named aggregate. The aggregate eager loads EntityB and EntityC. Because of an error (which we have since fixed up), we ended up with EntityB referencing a deleted EntityC. So when querying, there were three sql queries issued in the same batch. No problems. First two queries retrieved one row each, third query (for EntityC) had no rows. Got the following exception - 2010-09-28 12:40:05.4889 | ERROR | MyCode | 6 | The given key was not present in the dictionary. | System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
I guess this is caused because we have soft deletes - else we would have had a FK violation earlier on. But it would be nicer if there was some indication from LS that an eager load failed because there was no entity returned (and this was correctly considered an invalid model state), rather than a KeyNotFoundException. cheers |
|