you can do a SELECT ordered by DisplayOrder, with ROWNUMBER, and update the
DisplayOrder to ROWNUMBER, so you get the ordering bit happening in a single
SQL statement.



On Wed, Sep 17, 2008 at 1:02 PM, Paul Cowan <[EMAIL PROTECTED]> wrote:

>  I totally agree, I don't forsee any perf. problems.
>
> Could you elaborate on what you mean by this:
>
> >>more efficient SQL update query. it would be internal to the domain
> model, not affecting othe rparts of the application
>
> I realise this has nothing to do with NHibernate but I am curious as to how
> I would nicely integrate the SQL in the way you are describing?
>
> Cheers
>
> Paul
>
> [EMAIL PROTECTED]
>
>
> ------------------------------
>
> Date: Wed, 17 Sep 2008 00:32:18 +0300
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: [nhusers] Re: reordering a list
>
>
> I'd say - good ol' OO.
>
> class Section {
> ...
>     ReadOnlyCollection<Question> Questions ...
>
>    void DeleteQuestion(Question q) {
>       questions.Remove(q);
>       ReorderQuestions();
>    }
> }
>
>
> now ReorderQuestions() could be as simple as looping through the questions.
> once you hit a perf problem you can switch that into a more efficient SQL
> update query. it would be internal to the domain model, not affecting othe
> rparts of the application.
>
>
>
>
> On Wed, Sep 17, 2008 at 12:27 AM, [EMAIL PROTECTED] <
> [EMAIL PROTECTED]> wrote:
>
>
> hi,
>
> I have a standard object that contains a collection of
> sections.  Each section has a collection of questions.
>
> Each question has a display order for example:
>
> Q1's display order is 1.1
> Q2's display order is 1.2
> Q3's display order is 1.3
> Q4's display order is 1.4
>
> If I delete Q2, I need to reorder the display order so it
> reads:
> 1.1
> 1.2
> 1.3
>
> They are all Nh objects.
>
> What is the best way to handle the updates with NHibernste?
>
>
>
>
>
> --
> Ken Egozi.
> http://www.kenegozi.com/blog
> http://www.musicglue.com
> http://www.castleproject.org
> http://www.gotfriends.co.il
>
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to