How do you manage hundreds of "forms" with a LINQ-based model

I have a relatively modest dataset (probably 20 main tables), but asked in many different ways.

Sometimes we show the product. Sometimes a product with a picture. Sometimes a product with a picture and comments. Sometimes a product with a picture and all users who have a product and their photos.

etc .. (and "etc." I mean "many more permutations")

LINQ has capabilities to ensure that our queries grab all the information they need through DataLoadOptions. However, if you want to do something like "just show me 5 comments", you are now using the AssociateWith method on DataLoadOptions, which is now (in my opinion) awkwardly close to the DB to expose, say, codebeside files to your ASPX pages.

So - I'm curious how people deal with this? Do they actually create the model layer using the GetProductsWithPicturesAndUsersAndUserComments (int commentLimit, int pictureSize ...

... with every permutation? Especially from the Rails background where they figured it out, this solution seems to be very ugly. So, I'm hoping for something else. I wonder what others are going through.

Thank! Tom

0


source to share


1 answer


Well, the point of LINQ is that you can compose these queries yourself. As long as you map the model to the database correctly, you can query the table view in code and then compose that query with Take and it will take the first n rows.



+1


source







All Articles