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 the following model: EntityA EntityX : EntityY : EntityZ there is an association (1-1) from EntityY to EntityA. When I run a query on EntityY, I get the following error: Unable to materialize field [EntityAId] on type [EntityY]: field is type 'System.Guid' but database returned type 'System.String'. Check your table has an Id column and that your mappings are correct. See inner exception for details. System.InvalidCastException: Specified cast is not valid. at Mindscape.LightSpeed.Model.FieldModel.Materialize(IDataProviderAdapter, Object, Object[], ref Int32)
I've seen this before with associations on entities in an inheritance tree but I think you mostly fixed these in the last couple of months. The sql runs fine - all the columns are correctly mapped to column headings but when I last ran this sort of error through to the LS source code I found it was transposing fields - hence the type cast exception. For some reason it's reading columns out of the datareader that aren't relevant for this entity. Query is the following: Snippet var entities = UnitOfWork.EntityZ I'm using the nightly build from last night. Happy to pass more details... cheers justin |
|
|
Is it possible to get a small repro for this?
Thanks! Jeremy |
|
|
repro is with JD - through msn messenger. email was too big.
actual failing test is "Snippet when_querying_jobs2 |
|