For an example object with fields
Books
-----
ID
AuthorID
Qua开发者_高级运维ntity
ISBN
PublisherID
The 2 foreign key constraints correspond to Author Name & Publisher Name from 2 other tables.
- For viewing the said object in a listview, is it recommended to create 2 additional fields (AuthorName,PublisherName) inside the same class or to create a separate object with 2 fields and inherit other fields from the Books class ?
- What is the standard to follow for such scenarios inside enterprise applications ?
Damien.
I subscribe to the school of thought that you do not query an object model.
Your problem immediately evaporates :)
What I would do is use a simple query layer to return the data I need. In fact, I prefer a denormalized query store and if that isn't possible I will try to denormalize the table I am querying when doing inserts/updates and as a last resort I will use a join.
You may want to take a look at CQRS.
精彩评论