Obsivus
Obsivus

Reputation: 8359

LINQ: I have 3 tables and I want to make 2 join tables

I have three tables, Question, SubjectType and CoreValue.

Question table has many to many association to SubjectType table and CoreValue table.

I want to make 2 join tables: one between Question and SubjectType and one between Question and CoreValue.

How do I make sure that the Association tables with CoreValue FK and Question FK gets filled without inserting any values in Corevalue? CoreValue Table already have the values that is needed. I just need to be able to have FK on Question and Corevalue in same association table without inserting any data same goes to Question and SubjectType.

Thanks for advice!

Best Regards!

Upvotes: 0

Views: 96

Answers (1)

Gert Arnold
Gert Arnold

Reputation: 109080

Just create the tables as pure join tables in the database.

EF will generate a model with navigation properties (Question - SubjectTypes, and so on). You probably want to remove the associations SubjectType.Questions and CoreValue.Questions.

See also this tutorial (the Class-Student part).

Upvotes: 1

Related Questions