application-dependency

Circular dependencies in foreign keys: use it or avoid it?

只谈情不闲聊 提交于 2019-12-04 11:48:34
问题 My application loads lots of data from a database into a complex data structure. The in-memory data structure ressembles the structure of the database, which means that if the database contains the following tables: table A, key is A1 table B, key is B1, one of the columns is a foreign key to [the key of] table A table C, key is C1, one of the columns is a foreign key to [the key of] table B Then I have classes A, B and C, and: a data member of B (B::m_a) is a pointer to A a data member of C

Circular dependencies in foreign keys: use it or avoid it?

自作多情 提交于 2019-12-03 07:24:28
My application loads lots of data from a database into a complex data structure. The in-memory data structure ressembles the structure of the database, which means that if the database contains the following tables: table A, key is A1 table B, key is B1, one of the columns is a foreign key to [the key of] table A table C, key is C1, one of the columns is a foreign key to [the key of] table B Then I have classes A, B and C, and: a data member of B (B::m_a) is a pointer to A a data member of C (C::m_b) is a pointer to B This implies that if I load the database, that I have to load it in the