Page 1 of 1

Data Access Question

Posted: Thu Mar 27, 2008 8:18 am
by keats76
I'm trying to wrap my brain around the DAL (Data Access Layer) of AC7. It looks like you're using a Data Mapper pattern for data access. I'm just learning about patterns today ... good stuff. I want to make use of the same pattern in my custom code for AC.

As of yet, I haven't had much, if any, responses to my development related questions. I'm sure the dev staff is busy, but it would be very helpful if someone could chime in :).

I think I understand what is going on with the Data Sources now. You have a gateway class that uses static methods to populate objects for use in the .NET controls (like ObjectDataSource) or for your own custom use.

One item that confuses me though, is why AC saves the objects to the database in multiple ways? For example, if you look at the EditOrderItems.aspx admin page, AC allows the user to pull an Order object and then manipulate the child OrderItem objects. When AC goes to save the updated Order object, however, instead of saving it via the OrderDataSource.Update(Order) method, AC makes a call to Order.Save(). Could a developer take a quick look at this and expand on the reasons for doing this type of save (as opposed to saving via the OrderDataSource)?

I will be implementing a quoting engine that will contain Quote objects and QuoteItem objects (similar to the Order and OrderItem objects) and I'd like to understand the best practice for persisting and retrieving my objects from the DB.

I know this is long winded, but hopefully an AC developer can provide a quick response that might help a lot of folks out.

If there is a better method for me to obtain this type of information (i.e. developer support), please let me know and I'll try to go that route instead of posting these types of questions to the forum.

Thanks,
Mike

Posted: Thu Mar 27, 2008 11:35 am
by keats76
OK, so I've been reading on .NET 2.0 Data Access and it looks like the Update methods on the DataSource are used to provide the GridView with a means of performing auto updates on individual rows of the grid.

This makes sense. I'm just wondering why the DataSource controls aren't used for the persistence of objects saved outside of the GridView as well?

i.e. should my custom object be persisted to the database via a Quote.Save() operation or a QuoteDataSource.Update(quoteObject) call?

Posted: Fri Mar 28, 2008 8:38 am
by Shopping Cart Admin
Hello Mike,

Sohaib posted some information on the DAL. Hopefully this is what you're looking for.

viewtopic.php?t=6889