using (var ctx = new PortalContext())
{
var city = ctx.Cities.Find(42);
ctx.Entry(city)
.Reference(c => c.Province)
.Load();
city.Province = null;
ctx.SaveChanges();
}
时间: 2024-10-07 15:46:16
using (var ctx = new PortalContext())
{
var city = ctx.Cities.Find(42);
ctx.Entry(city)
.Reference(c => c.Province)
.Load();
city.Province = null;
ctx.SaveChanges();
}