Hi,
i am trying to create a new entity by cloning an old one and save the new entity back into db.
it is my studenthistory entity and here is what i have done:
var latestHistory = new StudentHistoryEntity(studentId, termId);
var newHistory = new StudentHistoryEntity { Fields = latestHistory.Fields.Clone() };
newHistory.TermId = newTermId;
newHistory.Save();
I keep getting
Cannot insert the value NULL into column 'StudentID', table 'StudentHistory'; column does not allow nulls. INSERT fails. The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
Am i missing something here?
ps: also tried setting the IsDirty property to true
and also tried setting IsChanged property to true. None worked.