I think the session would be out of scope of Controller.ListPerson() if it to be used such way in the view .
My question is, since the data usage behavior in well-known in the View, why don't you eagerly load the all Person's related data in the Controller.ListPerson()? I see no difference nor problem if you did it thay way. -- Regards, Maximilian Haru Raditya On Wed, May 11, 2011 at 9:30 PM, Samuel Pereira <[email protected]> wrote: > Hi guys, got the following environment. > * Desktop Application, using and enjoying NhibernateIntegration Castle (Latest > version, integrated with NHibernate 3.1.0.4). > * I use the MVC pattern. > > My problem is: Lose the Lazy in the view. > > Example situation: > > Example situation: > Model > [Serializable] > public Person { > [Property (Column = "name")] > public virtual string Name {get; set;} > > [ManyToOne (Lazy = Laziness.Proxy)] > Public virtual Address {get; set;} > } > > Controller > > public virtual IList <person> ListarPessoas () { > using (Session = sessionMananger.OpenSession ()) { > return Session.CreateCriteria<person>().List<person>(); > } > } > > View > ... > var people = controller.ListPeople (); > foreach (Person person in people) { > AdicionarLinha (person.Name, person.Address.Street (***)); > } > ... > > Note that in view (signposted ***), I need to use the Lazy, however, for > using the using, ismade to dispose the session at the end of the > controller method. > 1 - How to create a scope of conversation? There is something to that > effect? > > Following the Web model, each requisilção a session, this behavior does > not occur. > > I hope you can help me. > > -- > *Samuel Pereira * > Analista de Desenvolvimento > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" 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-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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-users?hl=en.
