Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aneesh 10 posts 29 karma points
    May 14, 2013 @ 11:08
    Aneesh
    0

    Update Contour record using the record ID

    HI,

    I can successfully create entries in contour programmatically(C#) but I am not able to update the created record using the record ID. After digging my head around can’t find a reason why the following code doesn’t work. It’s very basic and all That I am trying to do is get the record that exist in the contour.

     RecordStorage recordStorage = new RecordStorage();
    Record r = recordStorage.GetRecord(new Guid("15d654cb-a7c6-4f1f-8b55-0ecd7d19b0e3"));
    recordStorage.Dispose();

    Just to start with the update process, I am trying to get the record object using it’s id but can’t proceed further as it throws a weird error “An item with the same key has already been added.” I can’t understand while it’s trying to set the value when I call the “storage.GetRecord()”. Following is the stack trace


    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
    at Umbraco.Forms.Data.Storage.RecordFieldStorage.GetAllRecordFields(Record record)
    at Umbraco.Forms.Data.Storage.RecordStorage.GetRecord(Object id)
    at MauriceBlackburn.Service.ContourFormService.InsertRecord(ContourFormFields unionContourForm)

    Any thoughts, have I missed something, I have been digging all day around and still not able to figure this out. Thanks in advance.

    Much Appreciated.

     

     

  • Comment author was deleted

    May 15, 2013 @ 11:37

    Yeah that should do the trick, could it be that when creating the record you added a recordfield with the same id twice?

  • Comment author was deleted

    May 15, 2013 @ 11:40

    Added a fix in Contour to make sure it won't try to add an item with the same key 

    http://issues.umbraco.org/issue/CON-364

    Available in http://nightly.umbraco.org/Umbraco%20Contour/3.0.13%20WIP/

    Upgrade instructions here http://our.umbraco.org/projects/umbraco-pro/contour/documentation

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies