I would like to know how to delete an object from Entity Framework 4.1 without first having to load the object from the database. I have found these other 2 answers on Stack Ove
use stub entities:
public void DeleteCar(int carId)
{
var car = new Car() { Id = carId };
_dbContext.AttachTo("Cars",car);
_dbContext.DeleteObject(car);
_dbContext.SaveChanges();
}
reference:
http://blogs.msdn.com/b/alexj/archive/2009/06/19/tip-26-how-to-avoid-database-queries-using-stub-entities.aspx