views:

56

answers:

0

[We are using ActiveRecord.]

While running Sql Server Profiler, we noticed that a simple "Save" was preceded by a good bit of database activity. We found that the SubSonic core runs through all the properties and saves their values in a dictionary before it actually does the save.

We typically "extend" our data objects in partial classes that include some properties that require database activity. This is where the extra activity is happening, and, as far as we can tell, unnecessarily.

We changed where the script creates a property from each database column so that it now decorates these properties with [LocalData]. We then changed the core (Extensions.Objects.ToDictionary) to skip the GetValue if this attribute is missing.

In one test with a lot of save-type database activity, we saw the elapsed time drop from 21 seconds to 2, and the database activity drop by about two thirds.

There are two questions in all this is: 1) was there a feature we missed that would make our change unnecessary, and 2) if not, do you know of some other ToDictionary-related processes that will now break?

Thanks!