vb.net - ASP.NET MVC - Can't set overrideable property = nothing? -
let's have following entities:
public class dodo public property id integer public property name string public overridable property mother dodomother end class public class dodomother public property id integer public property name string public property age integer end class i need able set dodo.mother nothing once it's been set.
i.e.
dim ndodo dodo = db.dodos.find(1) ndodo.mother = nothing db.savechanges() when execute above code, don't error or exception or indicate statement hasn't worked. ndodo object doesn't seem set mother null , db doesn't updated.
am doing wrong? tried adding db.entry(ndodo).state = entitystate.modified didn't work either.
you need add id property dodo dodomother , set nothing.
public property motherid integer? your property 'mother' navagation property. navagation properties not part of database tables, part of entity classes.
Comments
Post a Comment