looking entity framework cascade delete. had cascade delete disable globally
modelbuilder.conventions.remove<manytomanycascadedeleteconvention>(); modelbuilder.conventions.remove<onetomanycascadedeleteconvention>(); we wanting re enable it. problem comes when creating migration error "may cause cycles or multiple cascade paths".
the solution of using fluent api works create..
modelbuilder.entity<campus>() .hasrequired(c => c.institution) .withmany() .willcascadeondelete(false); however institution causes more 1 problem institutionid everywhere. want avoid having go through every option , ignore them case case. possible stop cascade delete relationships on institution table?
institution's never deleted don't mind if there isn't cascade delete on that.
thanks
Comments
Post a Comment