我可以用編程方式(C#)成功創建輪廓條目,但我無法使用記錄ID更新創建的記錄。在挖掘我的頭後無法找到爲什麼下面的代碼不起作用的原因。這是非常基本的,所有我想要做的是獲得輪廓中存在的記錄。使用記錄ID更新等高線形式(記錄)
RecordStorage recordStorage = new RecordStorage();
Record r = recordStorage.GetRecord(new Guid("15d654cb-a7c6-4f1f-8b55-0ecd7d19b0e3"));
recordStorage.Dispose();
剛開始與更新的過程中,我試圖讓記錄對象使用它的ID,但由於它拋出一個奇怪的錯誤「具有相同鍵的項已被添加無法繼續進行。「當我調用」storage.GetRecord()「時試圖設置值時,我無法理解。以下是堆棧跟蹤
**An item with the same key has already been added.**
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)
有什麼想法,有我錯過了一些東西,我一直在周圍挖了一整天,仍然沒有能夠想出解決辦法。提前致謝。
備受讚賞。
這可能是一個要問我們的.umbraco.org – BeaverProj 2013-05-15 21:46:38