I tend to create tables in a database then drag them onto the dbml designer to create my DataContext. I usually create the associations in the dbml manually, should I be doing this, or should I have those associations in the database already? I ask, because in the MySQL world, these associations would have been represented by foreign keys, and I feel like I am bypassing that at the database level.
Share
You’re safer creating the foreign keys in MySQL. Your .NET code will honour these associations if they’re in the DBML only, but there won’t be anything at the database level to enforce the same constraints if you don’t create them, meaning direct DB SQL access could be dangerous.