So in this case, the 'T' is created by the container? I was thinking that the T in this case was more of an Entity rather than a service.
-d On Mon, Dec 6, 2010 at 10:51 AM, Bailey Ling <[email protected]> wrote: > the container needs to manage its disposal because the container created > it. currently, we don't have an issue because the T that this code is > creating doesn't have any decommission concerns. however, the moment we add > IDisposable then we run risk of a "memory leak". this is a windsor > implementation detail, so we shouldn't be relying on that and still call > Release() on our objects. > > using a "contextual lifestyle" would solve the problem (and there's already > an implementation in the castle lifestyle repository on github), but before > i go down that path i'd like to see if there's a cleaner solution. > > surely i'm not the only one creating a whole bunch of transient objects > with windsor that decide to stick with LifecycledReleasePolicy... > > > > On Mon, Dec 6, 2010 at 8:28 AM, Dru Sellers <[email protected]> wrote: > >> What aspect of this is the container managing? that you would need to call >> release on? >> -d >> >> On Fri, Dec 3, 2010 at 5:54 PM, bling <[email protected]> wrote: >> >>> i'm workin on a greenfield project right now and i'm not sure how to >>> properly use the RRR pattern for transient objects. we're using event >>> sourcing, and here's one of the methods: >>> >>> public T GetById(Guid id) >>> { >>> T instance = _factory.Create(id); // this is a typed factory >>> instance.Replay(GetEventsFor(id)); >>> return instance; >>> } >>> >>> so i guess the question is....who owns the object, and who releases >>> it? adding IRepository.Release() feels wrong. calling Dispose() on >>> the instance doesn't work unless i add some sort of >>> AutoReleaseInterceptor, which also feels wrong. >>> >>> any ideas? thanks. >>> >>> -- >>> 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]<castle-project-users%[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]<castle-project-users%[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]<castle-project-users%[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.
