Welcome Guest, Not a member yet? Register   Sign In
MVC issues...trying to avoid interacting with the database from my controller
#3

[eluser]D_Williams[/eluser]
I had considered doing the "grab everything" approach like that but the problem is the "accounts" table has something like 70 different columns. It's not my design and it's mainly used by a closed source software package so I have no option but to work with it like that. Grabbing 70 columns when I need 1 or 2 is a waste of resources, especially when I'm grabbing those 70 columns for potentially hundreds of accounts.

The first idea that comes to my mind here is having a GetAccounts function that only returns the ID, and then I can pass that ID to other functions like GetAddressByID(). That seems slightly better but I'm still left with the problem of designing a re-usable GetAccounts function. This may well be the only time in my program that I need to grab accounts with these particular three conditions. Each time I pull account information, the fields that ultimately go into the "where" clause will likely be a little bit different. Obviously I don't want to have a thousand little functions like that to cover every possible scenario, but I can't come up with a clear solution.


Messages In This Thread
MVC issues...trying to avoid interacting with the database from my controller - by El Forum - 09-24-2010, 02:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB