This is a migrated thread and some comments may be shown as answers.
Efficiencies and Problems when updating foreign key
1 Answer 33 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
richardFlow asked on 18 Mar 2010, 11:26 AM

When updating a foreign key in a class, instead of just being able to update the Id, i have to retrieve the entire object and then update it. this needs an unnecessary call to the database.  Is there a workaround?

I get the following error when running the following code:

"Unable to set slave column value"

internal DAL.ProductAttributeValue CreateDALObject(intattUid, int prodUid)



DAL.ProductAttributeValue newProductAttributeValue = newDAL.ProductAttributeValue();

              newProductAttributeValue.AttributeUid = attUid;    [A]

newProductAttributeValue.ProductUid = prodUid;    [B]




return newProductAttributeValue;


and i need to reaplace [A] and [B] with the following instead to make it work (where RetrieveDALObjectByKey returns the openaccess generated class.:

newProductAttributeValue.Attribute = (newAttributeManager(DAL_scope)).RetrieveDALObjectByKey(attUid);

newProductAttributeValue.Product = (newProductManager(DAL_scope)).RetrieveDALObjectByKey(prodUid);

Your thoughts would be appreciated.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Mar 2010, 01:51 PM
Hello Web Belief Ltd,

This exception usually indicates inconsistency in your mapping. It could mean that the ProductAttributeValue.AttributeUid field is not mapped to the same column as the identity field of your Attribute class. Can you send us your App.config file so we can evaluate further the issue and tell you the exact cause of your problem.

All the best,
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Development (API, general questions)
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question