I have already created an entity but want to update a value of a non-nullable column. I use the Update method from EF to try this but doesnt work. Is it possible to update a non-nullable value?
public void Update(T entity)
{
_context.Set<T>().Update(entity);
}
just add SaveChanges()
public void Update(T entity)
{
_context.Set<T>().Update(entity);
_context.SaveChanges();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.