c# - How can I remove a reference from an entity object to another entity with the Entity Framework? -
i have entity locations primary key consisting of longitude , latitude double.
from entity object want remove reference entity object in locations every time try set reference null optimisticconcurrencyexception.
using (mymodelcontainer context = new mymodelcontainer()) { note note = context.notes.single(n => n.nid == noteupdate.nid); note.locationreference.load(); note.locationreference = null; context.savechanges(); } but not working. same note.locationreference.value = null.
how can set reference null or default value?
i believe purpose update db location column of note row set null here, detaching not going work. think replacing note.locationreference = null; note.location = null; in code above should work
Comments
Post a Comment