c# - MariaDB cant insert data with entity framework 5.0 -


i have problem inserting data in database. have 3 tables created heidesql , linked 3 tables foreign key. 1st table (many one) 2nd table (one many) 3rd table. when try insert new data db.savechanges(); throws insert exception tells me cant match foreign key because 2 or more objects have same primary key. have 1 id-field in each table auto_increment. use id-field of 2nd table link in first , 3rd one. problem everytime create new database object insert add same object belongs 2nd table db-object stays same. same object 1st table. might mistage , how can fix this? code , pic of database attached. hope helps understand problem.

cheers, only3lue

 db.zeichnungs.add(zeichnung);                 db.projekts.add(projekt);                 db.tags.add(tag);             }             try             {                 db.savechanges();             } ... 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -