This is a migrated thread and some comments may be shown as answers.

Exception in AttachCopy with computed columns

1 Answer 62 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernd
Top achievements
Rank 2
Bernd asked on 30 Jan 2017, 10:31 AM

Hello all.

I have a table with computed columns. They are marked as such in the meta data source:

configuration.HasProperty(x => x.EndWeek).WithDataAccessKind(DataAccessKind.ReadOnly).IsNullable();
configuration.HasProperty(x => x.StartWeek).WithDataAccessKind(DataAccessKind.ReadOnly).IsNullable();
configuration.HasProperty(x => x.Duration).WithDataAccessKind(DataAccessKind.ReadOnly).IsNullable();

Performing an update via "AttachCopy" throws an exception.

Telerik.OpenAccess.Exceptions.InvalidOperationException: The update of field 'idee5.Dispatcher.Model.DAL.CalendarEvent.<Duration>k__BackingField' is not allowed.
 
Quellfehler:
 
 
Zeile 66:       public CalendarEventViewModel Update(CalendarEventViewModel updatedObject) {
Zeile 67:           CalendarEvent toBeUpdated =  _mapper.Map<CalendarEvent>(updatedObject);
Zeile 68:             _db.AttachCopy(toBeUpdated);
Zeile 69:           _db.SaveChanges();
Zeile 70:           return updatedObject;

 

How can I tell DataAccess to handle those computed columns correctly by ignoring changes?

Thanks

Bernd

1 Answer, 1 is accepted

Sort by
0
Bernd
Top achievements
Rank 2
answered on 12 Mar 2017, 12:40 PM
Any ideas?
Tags
Data Access Free Edition
Asked by
Bernd
Top achievements
Rank 2
Answers by
Bernd
Top achievements
Rank 2
Share this question
or