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'm having a problem setting up a Custom Association Resolver for an existing database. I've based my Custom Association Resolver on examples from this forum. My database tables have primary key constraints set up but no foreign keys. My parent entity (design) has a composite key. The child entity (item) has a composite key, which includes the composite key from the parent (design) entity. I'm trying to set up this parent/child relationship in LightSpeed. I'm receiving the following error message: "Unable to materialize field [Dwg] on type [ConsoleApplication2.Item]. Check your table has an Id column and that your mappings are correct. See inner exception for details. " I'm not sure what I'm missing. My files are attached, thanks. |
|
|
The problem is that the Dwg column is mapped twice in Item -- once via Item.Id.Dwg and once via Item.DesignId.Dwg. Basically because you have an association from Item to Design, the LightSpeed designer generates a foreign key field (of composite type, to match the composite key of the Design entity) in the Item entity; but in this case all the columns of the foreign key are already part of the Item.Id primary key. What you will need to do is set the association's Generation property to None and manually implement the association in the partial classes, but NOT implement the
With these changes your test case works for me -- let us know if you run into any problems or need any further guidance. |
|
|
Thank you Ivan, your solution worked great. |
|