views:

141

answers:

1

Hi. I'm using subsonic 3.0.0.3 (active record) quite a simple database really, have trusted in its abilities but i am really getting let down by how incredibly slow it it to do anything.

For some reason it likes to run through things more than once. For example:

var newitem = new new_quote_item
{
  quote_id = Convert.ToInt32(newQuoteID),
  isextra = true,
  qty = qty,
  measureX = 0,
  measureY = 0,
  prodid = Convert.ToInt32(prodid)
};

newitem.Save();
// claculate price and add to total
var iteminfo = extra.SingleOrDefault(x => x.id == Convert.ToInt32(prodid));

that will run twice, but inside extra ( the subsonic classes) this can be 3 or 4 loops, really should it be able to create this class once? Why does it have to be initialized, then initialized all over again.

Has anyone had this kind of trouble before? It shouldn't take 20 mins to get back a simple quote.

Thanks

+3  A: 

You're doing 2 things here: 1) Saving a new class 2) Pulling the record back out.

This will result in two queries - one to INSERT, the other to SELECT. There are no "loops" and I have no idea what you're saying about 3 or 4 loops and "creating the class once". You write the code - you have the object already.

Ad far as 20 minutes goes - that's not SubSonic my friend. As you noted here http://stackoverflow.com/questions/1296447/subsonic-mvc-and-activerecord/1296581#1296581

SubSonic is pretty quick and won't take 20 seconds. Check the memory on your server.

Rob Conery
i think my problem may be with the amount of inserts i have as i am creating the whole quote at once and adding each item as needed, and getting the price for each too, im sure you did something called batch update or insert into subsonic got any good pointers on this ???? thanks
minus4