Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have tables in our database with hundreds of columns (with some, but not much referential integrity).
In my web App I want to show a list of entities (e.g. a list of customers) - so I really only want to bring down the Id, name and possibly a couple of other columns.
When the user selects the customer, I might then call another API to get additional details for display and/or update.
Other areas of my apps may require different sub-selections of data. Some may require joins to other tables (e.g. join to CustomerType table) others not.

There are many techniques we could use to achieve this - what I am looking for is your experiences - what has (or hasn't) worked for you.

What I have tried:

Defining many small classes for return (Customer, Customer_List, Customer_Detail_List)

Always bringing the whole Customer data, together with any referential field data.

Defining many SQL Views, (Customer_List, Customer_Detail_List) and using an ORM to return from each.
Posted
Comments
[no name] 19-Jun-18 18:14pm    
I'd probably try cleaning up first what's there.

See how much redundancy there is. What's "obsolete" / not claimed.

Think about "templates". Code generation.

(Give users a copy and MS Access)
_Maxxx_ 21-Jun-18 18:32pm    
Thanks. we can't change what's there as it is used in all its denormalised glory by a CRM system
Not sure how giving users MS Access would help in any way?
Eric Lynch 19-Jun-18 19:07pm    
Serialization with something like JSON.NET can also allow you to omit null/default values. So, if you use nullables or have a good default value you can use for absent items, you can greatly reduce the size of the serialized data during transport. This might allow you to use a single class.
_Maxxx_ 21-Jun-18 18:33pm    
We're doing that, but this still results in a class on the client of 700+ fields - and when I just want a list of customer ids and names, this is obviously completely over the top!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900