You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tracstarr
August 24th, 2011 at 21:41
Reply | Quote | Edit | #3
What about when I need to use specific lifetimescope within a using from a viewmodel? How can I do this without exposing the container? Or will I just have to?
using (var scope = Container.BeginLifetimeScope(“Commit”))
{
….
}
david
August 24th, 2011 at 22:53
Reply | Quote | Edit | #4
Good question. I don’t have an answer yet, but I will give it some thought. Can you provide a use case for this?
tracstarr
August 25th, 2011 at 07:25
Reply | Quote | Edit | #5
Well, in my case it’s for accessing my data layer services. I use the lifetimescope in this way to make sure I don’t have a constant open connection and instances of service classes open.
What I’ve done since this post was to expose the container property as public, and then in the GetInstance i added:
if (serviceType == this.GetType()) return this
That allows me to use IoC.Get().Container.BeginLifetimeScope
It’s the only thing i’ve come up with so far.
The text was updated successfully, but these errors were encountered:
From blog comment:
http://buksbaum.us/2010/08/20/bootstrapping-caliburn-micro-with-autofac/comment-page-1/#comment-1694
tracstarr
August 24th, 2011 at 21:41
Reply | Quote | Edit | #3
What about when I need to use specific lifetimescope within a using from a viewmodel? How can I do this without exposing the container? Or will I just have to?
using (var scope = Container.BeginLifetimeScope(“Commit”))
{
….
}
david
August 24th, 2011 at 22:53
Reply | Quote | Edit | #4
Good question. I don’t have an answer yet, but I will give it some thought. Can you provide a use case for this?
tracstarr
August 25th, 2011 at 07:25
Reply | Quote | Edit | #5
Well, in my case it’s for accessing my data layer services. I use the lifetimescope in this way to make sure I don’t have a constant open connection and instances of service classes open.
What I’ve done since this post was to expose the container property as public, and then in the GetInstance i added:
if (serviceType == this.GetType()) return this
That allows me to use IoC.Get().Container.BeginLifetimeScope
It’s the only thing i’ve come up with so far.
The text was updated successfully, but these errors were encountered: