This question is locked. New answers and comments are not allowed.
I see your following sample in Document Explore about Building N-Tier Applications:
using (EntitiesModel dbContext = new EntitiesModel())
{
Car attachedCar = dbContext.AttachCopy(carToDelete);
dbContext.Delete( attachedCar );
dbContext.SaveChanges();
}
using ( EntitiesModel dbContext = new EntitiesModel() )
{
dbContext.AttachCopy( carToUpdate );
dbContext.SaveChanges();
}
My question is what's purpose of AttachCopy method? Whether this is the good practice for delete or update operation?
using (EntitiesModel dbContext = new EntitiesModel())
{
Car attachedCar = dbContext.AttachCopy(carToDelete);
dbContext.Delete( attachedCar );
dbContext.SaveChanges();
}
using ( EntitiesModel dbContext = new EntitiesModel() )
{
dbContext.AttachCopy( carToUpdate );
dbContext.SaveChanges();
}
My question is what's purpose of AttachCopy method? Whether this is the good practice for delete or update operation?