I had a code below, when application target was .NET4.
using (DbImageEntities db = new DbImageEntities())
{
_Photo.Data = stream.ToArray();
db.Photo.Attach(_Photo);
db.ObjectStateManager.ChangeObjectState(_Photo, EntityState.Modified);
db.SaveChanges();
}
When app was downgraded to .NET 3.5 target, Attach(…) and ChangeObjectState(…) calls failed. How to modify this code for 3.5 compatibility? Thanks beforehand.
Downgrading EF from 4.0 to .NET 3.5 is very very bad idea. Simply don’t do that. The result will be rewriting half of your application.
You can change it to something like: