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 have an odd error, I have two tables X and Y, there is a one to one relationship between them. X has an PK which is an auto increment ID called XID. Y has a PK which is also a FK to table X, this PK is also called XID. I can create a record in X no problem, but when I create a record in Y using the XID from X it fails. The basic code is:
x.Id (XID) now has a value.
At this point I get an exception "An error occurred when trying to assign a new Identity value to this entity. Check inner exception for details", with and inner exception of "Object cannot be cast from DBNull to other types." I have included a raw dump of the exception...
Thanks in advance for your support. |
|
|
What identity strategy are you using for Y? You could try overriding Entity.GenerateId on Y to control Id assignment but in general this type of mapping is going to have issues as this is not supported by LightSpeed, we expect the PK and FK to be distinct fields.
|
|