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?


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -