Lets say we have a :
class Zoo{
Id;
Name;
List<Animal> Animals;
}
class Animal{
Id;
Name;
ZooId;
}
Normally I would do
var zooId=1;
var animalId=1;
var animal = db.Animals.FirstOrDefault(x=>x.Id==animalId);
animal.ZooId=zooId;
db.SaveChanges();
Correct me if I am wrong,but the ef.core would run a Select query and then an update query.
Is there a way to write a code which would produce a single SQL query like:
'Update Animal Set ZooId=1 where Id=1'
(Preferably by using lambda code)
Thank you!