I have an Entity Framework CodeFirst Class (POCO) :
class Contract : IMyContract
{
...
}
interface IMyContract
{
public int DateSigned{get;}
}
why am I not able to intercept context change operations in this way when a Contract is being modified by a client :
void context_SavingChanges(object sender, EventArgs e)
{
foreach (ObjectStateEntry entry in
((ObjectContext)sender).ObjectStateManager.GetObjectStateEntries(
EntityState.Added | EntityState.Modified | EntityState.Deleted))
{
IMyContract myContract = entry.Entity as IMyContract;
if(myContract != null)
{
...
}
}
}