Efficiencies and Problems when updating foreign key

2 posts, 0 answers
  1. richardFlow
    richardFlow avatar
    62 posts
    Member since:
    Jun 2012

    Posted 18 Mar 2010 Link to this post


    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.

  2. Zoran
    Zoran avatar
    534 posts

    Posted 22 Mar 2010 Link to this post

    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.
  3. DevCraft banner
Back to Top