I'm getting the following error when setting a value of a related entity.
I have a ItemData entity, and it's related ProductDescription record (joined via ItemNumber in the Entity Relations tab).
When I retrieve the ItemData record, I can use ItemData.ProductDescription.ItemText and get the value, as the record exists in the ProductDescription table. However, when saving the data, I'm assigning a value to the ItemText field in the ItemData.ProductDescription object using ItemData.ProductDescription.ItemText = x and I get a Null Entity Cannot be modified error.
Any ideas? I've pasted the exception below.
IdeaBlade.Util.IdeaBladeException was unhandled by user code
Message="Null entity cannot be modified"
Source="IdeaBlade.Persistence"
StackTrace:
at IdeaBlade.Persistence.EntityTable.OnColumnChanging(DataColumnChangeEventArgs pArgs)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at IdeaBlade.Persistence.Entity.SetColumnValue(DataColumn pSetColumn, Object pValue)
at ComNET.Data.ProductDescriptionDataRow.SetItemTextImpl(String value) in D:\code\CatalogManager\CatalogManager.Data\ComNET.Data\ProductDescriptionDataRow.cs:line 488
at ComNET.Data.ProductDescriptionDataRow.set_ItemText(String value) in D:\code\CatalogManager\CatalogManager.Data\ComNET.Data\ProductDescriptionDataRow.cs:line 480
at CatalogManager.ItemDetail.btnSave_Click(Object sender, EventArgs e) in D:\code\CatalogManager\CatalogManager\ItemDetail.aspx.cs:line 211
at DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e)
at DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument)
at DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: