Take the following pseudocode database
table Foo
{
FooID int not null,
name varchar not null
}
table Bar
{
BarID int not null,
name varchar not null
}
table Waa
{
WaaID int not null,
name varchar not null
}
table Link
{
LinkID int not null,
FooID int null,
BarID int null,
WaaID int null,
Description varchar not null
}
The purpose of the Link table is to allow me to link entities together in a single table, without having multiple Foo_Bar_Link, Foo_Waa_Link etc. tables.
I am moddeling this DB in EntityFramework v5. As such, i want to be able to specify a One to Many relationship between Foo and Link, so that i can get all the Links associated with a given Foo.
Problem
EntityFramework Designer only lets one-many relationships exist where the foreign key is not null. I want a Foo to have a navigation property Associations which gets all of the Association entities with FooID = Foo.FooID. As a note, i am using the Designer.
Generictable withTableandColumnvalues (for example"Foo": 1,"Bar":2), so that one can lazily join the tables usingWHERE Table = 'Foo' and Value = 1which is horribly bad practice. The table design is explicit (This foo is related to This Bar) - David Colwell