c# - Error in MySQL syntax when adding object to objectcontext -
i seem have trouble adding objects tables have 'n n' relationship.
tables defined follows:
table a
- id (primary)
- ...
- ...
- ...
table b
- id (primary)
- ...
- ...
- ...
table c
- tablea_id (index)
- tableb_id (index)
so table c links table , b, ids. using entity framework have object tablea containing entity collection of tableb entities.
however when add existing object of type tableb tablea.tablebs entity collection property, receive exception:
you have error in sql syntax; check manual corresponds mysql server version right syntax use near '(select\n
tablec
.tablea
, \n ' @ line 1
it seems i'm trying normal / common thing, i've not been successful getting work.
c# code:
var database = new databaseentities(); var tableaobject = database.singleordefault(e => e.id == 1); var tablebobject = database.singleordefault(e => e.id == 1); tablea.tablebentities.add(tablebobject); database.savechanges();
apparently i'm doing wrong, question is, how should add object table c?