public override object Resolve(ResolveContext context, DependencyRegistration registration) { object instance; if (!_instances.TryGetValue(registration.Key, out instance)) lock (_instances) { if (!_instances.TryGetValue(registration.Key, out instance)) _instances.Add(registration.Key, instance = base.Resolve(context, registration)); } return instance; }
public override object Resolve(ResolveContext context, DependencyRegistration registration) { CheckContextStoreAvailable(); object instance; var contextStore = Resolver.Resolve<IContextStore>(); if ((instance = contextStore[registration.Key]) == null) { if (registration.IsInstanceRegistration) throw new DependencyResolutionException("A dependency registered as an instance wasn't found. The registration was removed."); instance = base.Resolve(context, registration); StoreInstanceInContext(contextStore, registration.Key, instance); } return instance; }
public ObjectBuilder(ResolveContext context, ILogger log) { ResolveContext = context; Log = log; }
public virtual object Resolve(ResolveContext context, DependencyRegistration registration) { return context.Builder.CreateObject(registration); }