Sql – Associate table with NULLABLE id to another in Linq OR designer

linq-to-sql

Have been able to find similar questions to this but they don't explain exactly the problem I'm having.

I've inherited a database schema that I can't change, and it's slightly ropey, so LINQ doesn't really like it.

We have:

Table A [child table]

OrderId NULL int

Order Table

Id NOT NULL Primary Key Int

There is no foreign-key association between the two in the database.

I can add both to the LINQ designer, and also add an association no problem.

But the generated classes do not have an association, for example ENTITYSET or ENTITYREF between the two.

I've found other answers and this set up seems to be okay.

Any gotchas/glitches why this would be the case for me?

Thanks

Best Answer

Can't you proceed without an association? LINQ to SQL does need standard, boring table relationships (it can't even handle many-to-many really) so if you're not responsible for the schema then I don't think there's much you can do. It's a little more code without the relationships in place but LINQ to SQL makes database access so easy that it's no bother.

Related Topic