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, We are using Lightspeed 2.x for a current project. I have a question regarding how exceptions are handled. Assuming the following scenario: I want to retrieve a record from the DB given a certain Id. However that record doesn't exist in the DB. Right now the only exception I am getting is a "NullReference" exception because the query failed and the Lightspeed entity could not be created. That exception is pretty useless since it is not specific enough to let the user no that the record was not found. Am I missing something ? Regards Rainer Wollgarten Datacom Relate
|
|
|
Can you show us the code that causes the exception please? When I write the following: var contribution = unitOfWork.FindOne<Contribution>(1234234); // does not exist in DB I get a null reference back, rather than an exception. FindOne returns null to indicate that no corresponding record was found, which when querying by ID means the ID does not exist in the database. So you should be able to just test the return value, and if it is null you can inform the user that the record was not found. |
|