I need to to build a GUI to query a database, and I opted to use Entity Framework and the database-first approach.
The database has a flaw in it's layout, in my opinion, and I wonder what my options are to correct this in the ef model (and how).
The database looks like this:
CREATE TABLE a (
idA int
)
CREATE TABLE b (
idB int
)
CREATE TABLE c (
idC int,
fkA int,
fkB int
)
The design issue I see is that items in B do not exits alone, they are always related to A. The following tables would make more sense:
CREATE TABLE a (
idA int
)
CREATE TABLE b (
idB int,
fkA int,
)
CREATE TABLE c (
idC int,
fkB int
)
With words, c is set up to be a child of independent a and b, while in reality, b is always a child of a, and c is a child of b (and of a in consequence).
How would I modify the generated model to change this, if this is possible at all? Using Visual Studio, and the EDMX Model editor, obviously, but what changes do need to make to the model so that is still loads the wrong database layout, but offers the corrected one to the GUI?
The GUI will only read data, there is no need write anything anytime.
Thanks!
navigation
table for the many to many relations from table a to b. – M.B. May 10 '19 at 7:45