ActiveRecord members would only perform update on row by row basis.

If you want to update a single item, you can do it in the same way as
you showed (prefer Save() if no primary key "api restriction" is in
your way)

if you need batch update, you can still execute your procedure with
the ISession access from ActiveRecordMediator.Execute or elsewhere.

Hope this helps

On Jan 9, 12:40 am, Scott <[email protected]> wrote:
> I have a database table that has a number of fields, one of which is
> called ViewCount and is numeric. I want to increment this value for a
> record anytime its information is displayed, but am not sure how best
> to do this with ActiveRecord.
>
> If I were not using ActiveRecord, I'd create a stored procedure that
> did something like:
>
>    UPDATE TableName SET ViewCount = ViewCount + 1 WHERE ID = X
>
> And I'd call that stored procedure from my middle tier whenever the
> method that retrieves a record for display is called.
>
> I know that with ActiveRecord I could add something like the following
> to my middle tier:
>
>     MyObject obj = MyObject.Find(id);
>     obj.ViewCount++;
>     obj.Update();
>
> And that would do the trick, but my concern is that the database table
> includes a number of columns that contain large amounts of text and
> binary data. I am worried about performance if every time I increment
> ViewCount I am pulling back the values in these potentially large
> columns. Is there a way to tell ActiveRecord to not pull back ALL
> columns when I do a Find, or is there some other approach I should be
> taking to increment a counter field?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to