This question is locked. New answers and comments are not allowed.
I am using ORM 2013.1.219.3 and ASP.NET Web API with Kendo UI.
In my Entities model I have table called "Assets" with a column called "CreatedDate". The column value is set by a Default Constraint "GetDate()" added to the table. In the model I set the fields's Kind value to PersistentReadOnly and the resulting class has the correct property defined:
I can get the value and display it correctly on a web page when editing the record. The problem I am having is when I click Save to submit my changes an error is thrown on this line "TEntity attachedEntity = dataContext.AttachCopy(entity);" in the OpanAccessBaseRepository class. The error message is "The update of field 'AssetTracking.DataLayer.Asset._createdDate' is not allowed."
How do I indicate to OpenAccess that the field should not be included in the update?
In my Entities model I have table called "Assets" with a column called "CreatedDate". The column value is set by a Default Constraint "GetDate()" added to the table. In the model I set the fields's Kind value to PersistentReadOnly and the resulting class has the correct property defined:
private DateTime _createdDate;public virtual DateTime CreatedDate { get { return this._createdDate; }}I can get the value and display it correctly on a web page when editing the record. The problem I am having is when I click Save to submit my changes an error is thrown on this line "TEntity attachedEntity = dataContext.AttachCopy(entity);" in the OpanAccessBaseRepository class. The error message is "The update of field 'AssetTracking.DataLayer.Asset._createdDate' is not allowed."
public virtual TEntity Update(TEntity entity) { if (entity == null) throw new ArgumentNullException("entity"); TEntity attachedEntity = dataContext.AttachCopy(entity); dataContext.SaveChanges(); TEntity detachedEntity = dataContext.CreateDetachedCopy(attachedEntity, fetchStrategy); return detachedEntity; }How do I indicate to OpenAccess that the field should not be included in the update?