c# - Error 112 and Error 113 after adding foreign keys to database -
this table ( part of whole thing , activity table still have other relationships other tables) :
after adding foreign key , update model edmx database in visual studio , came 2 error :
error 2 error 112: types of properties in dependent role of referential constraint must same corresponding property types in principal role. type of property 'activityid' on entity 'istellarmodel1.singalong' not match type of property 'activityid' on entity 'istellarmodel1.activity' in referential constraint 'fk_singalong_activity'.
and
error 1 error 113: multiplicity not valid in role 'activity' in relationship 'fk_singalong_activity'. because properties in dependent role nullable, multiplicity of principal role must '0..1'.
i checked activityid in singalong have same type activity table's activity id , , don't understand error 113 means , new database , @ first have many tables don't link link them after sometime , update model ( edmx ) in visual studio ( using entity framework ) , gave me errors .
any guidance on please?
the 113
error sounds activity id in singalong
nullable.
it's stating many-to-one not valid if dependent role nullable.
that seems suggest reason 112
- it's complaining because considers not null
part of type well, 2 columns different.
a quick fix may ensure singalong.activityid
marked not null
problematic if want singalong records no corresponding activity.
i know how i'd fix it, @ least initially, may frowned upon more knowledgeable dbas: i'd add dummy activity (eg, activity id = 0) use cases have null in singalong
table. i'm not suggesting do that, it's possibility i examine temporary fix, being far more of pragmatist dogmatist :-)
Comments
Post a Comment