Skip to content

Why require Foreign Key on insert recored into table Entity

Tahir Rehman

Tahir Rehman

Asked Sep 23, 2017, 11:54 PM EDT1 answer
Share
LinkedInX
in Student info there is primary key admission_no, that lies as foreign key on other tables. whenIi insert record in Student info a message show One or more validation errors was detected during model generation:
 
CodeFirstNamespace.admin_fee: : EntityType 'admin_fee' has no key defined. Define the key for this EntityType.
CodeFirstNamespace.month_fee: : EntityType 'month_fee' has no key defined. Define the key for this EntityType.
CodeFirstNamespace.result: : EntityType 'result' has no key defined. Define the key for this EntityType.
 
how I insert a record into Student info table

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Surya Kant
    0
    Hi;
    I think it's fired validation error due to dependancy of your Adminsion_info table and other three entity. 
    Check what data you providing and how the properties of Adminsion_info are related to other table or else post your code it will better to give answer.
     
    Thanks.
    0