Fabio,

Thank you for this, you gave me a whole evening of reading about IoC
and hopefully making me a better programmer overall.  However, I
believe between the language barrier and my inability to grok your
blog post I was hoping that you could humor me and simplify it a bit.
I see there are libraries out there to handle this such as Rhino
Commons, but I am wanting to implement something myself if not for the
pure purpose of learning.

Here are where my hangups are:

1.  If I go to using IoC for my session management I still do not see
how that takes care of possible orphaned sessions or prematurely
closed sessions.
2.  If I use one very long session through the life of the program and
just call commits on that session I am worried about the caching and
other possible issues.
3.  I REALLY do not want to make my forms cognizant of the session
handling however I do not know how I can get around this since for
lazy loading I have to leave a session open which could possibly
result in orphaned sessions.  Yet, I do not see any other way to close
those sessions without the form giving some kind of notification to
the DAL.
4.  Even if I did fully grok IoC and CpBT, which I don't and that is
probably the problem, I don't see how that handles leaving sessions
open to allow for lazy loading unless there is some way to intercept
the lazy loading call so that you can open the session get the
information that needs to be loaded then close the session again.
However, I have no idea if that is possible or how it would be
implemented.

I apologize for being so dense when it comes to this.  Handling these
sessions has forced me to think more abstractly than I normally do,
which is a good thing, thus why I want to take this experience and
learn from it.

Thanks again,
Josh



On Jun 22, 1:51 pm, Fabio Maulo <[email protected]> wrote:
> CpBThttp://www.google.com/cse?cx=partner-pub-3540853588757452:ex3eysuf5tg...
>
> 2009/6/22 joshlrogers <[email protected]>
>
>
>
>
>
>
>
> > I am sorry, I should have made that clear.  This is a winforms
> > application.  Sorry about that.
>
> > Thanks,
> > Josh
>
> > On Jun 22, 12:04 pm, Marcus Rehm <[email protected]> wrote:
> > > Hi Josh,
>
> > > Your application is web based? If so you should open the session at
> > > "begin request" and close it at "end request" events. This away you
> > > will have a session open every time yuo need it in the time of the
> > > request.
>
> > > Hope it helps.
>
> > > On Jun 22, 1:16 pm, joshlrogers <[email protected]> wrote:
>
> > > > I apologize in advance as I know there is quite a bit of documentation
> > > > out there in regards to this, however I am trying to string together
> > > > everything I have read and hope that you can assist me in this.
>
> > > > I have developed a "session manager" of sorts that hands out a session
> > > > when function needs to access the database then when that function is
> > > > finished it lets the manager know that it can dispose of the session.
> > > > However with get functions I have to leave the session open for lazy
> > > > loading to work properly.  This is what is causing my problem, I
> > > > believe.
>
> > > > In a particular issue I am binding my IList to a DataGrid.  Which that
> > > > works out fine unless I perform a write function then begin to scroll
> > > > that grid.  So essentially I am doing the following.
>
> > > > 1. Open Session
> > > > 2. Get Information From DB in the form of an IList
> > > > 3. I fill a custom collection that implements CollectionBase and
> > > > ITypedList so I have control over how things are displayed in the
> > > > grid.
> > > > 4. Binding is successful and datagrid is populated.
> > > > 5. The user makes an arbirtrary change somewhere it is irrelevant
> > > > 6. This change calls a function that asks for a session from the
> > > > "session manager."
> > > > 7. The session manager sees that there is already an open session so
> > > > it hands that one over to the function.
> > > > 8. Because this is a write function it lets the session manager know
> > > > the session can be closed at the end of the write.
> > > > 9. Write is successful.
> > > > 10. User has saved the data and now begins to scroll the grid.
> > > > 11. Exception is thrown because the session is no longer open and
> > > > cannot retrieve the data needed.
>
> > > > So I imagine my solution is that I shouldn't be re-using the session
> > > > that I opened from the get function.  However, I would have no
> > > > possible way to know when I could close that session unless it was
> > > > when the form closed.  If that is the case I would need to keep a list
> > > > of all sessions that are open and close them upon closure of the
> > > > form.  However I did not really want to make the form aware of what is
> > > > going on in the DAL so do I have options here or am I going to have to
> > > > make the form somewhat cognizant of the DAL so that it can properly
> > > > dispose of the open sessions?
>
> > > > Thanks in advance,
> > > > Josh- Hide quoted text -
>
> > > - Show quoted text -
>
> --
> Fabio Maulo- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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