Search code examples
sqllinqforeign-keys

Create LINQ Association without Foreign Keys


Is it possible to have something like ContactAddress.Contact in LINQ without creating a foreign key relationship in SQL Server between those two (which would be Contact.Id <-> ContactAddress.ContactId)?


Solution

  • If you want to create a relationship in your Object-Relational Map (even when that relationship doesn't exist in the database as a declared foreign key), then you can do so using the Object-Relational designer.

    http://msdn.microsoft.com/en-us/library/bb629295.aspx