-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How i can intergate with Prism Unity? #20
Comments
I use ReactiveUI so it is more complicated but the concepts are the same, in your Program.cs or a BootStrapper class, I use Locator.CurrentMutable.RegisterConstant(PersistanceService.Tracker, typeof(Tracker)); PersistanceService is the class you can find in the samples and documentation, it may have a different name, the next step is to use the service like so, "Locator.Current.GetService().Track(this);" |
So this is an old issue that I never got around to answering. It's a few years too late now, especially since it seems Unity is no longer maintained, but I'm closing old issues so here's the answer... I use the following extension to apply tracking to all resolved objects: public class TrackingExtension : UnityContainerExtension
{
class TrackingStrategy : BuilderStrategy
{
readonly Tracker tracker;
public TrackingStrategy(IUnityContainer container)
{
tracker = container.Resolve<Tracker>();
}
public override void PostBuildUp(ref BuilderContext context)
{
base.PostBuildUp(ref context);
if (RemotingServices.IsTransparentProxy(context.Existing) == false)
{
Type targetType = context.Existing.GetType();
tracker.Track(context.Existing);
}
}
}
protected override void Initialize()
{
Context.Strategies.Add(new TrackingStrategy(Container), UnityBuildStage.Creation);
}
} I register it with the container like so: Sorry about the extremely late reply. |
i found Jot.Unity but how use it?
The text was updated successfully, but these errors were encountered: