/// <summary> /// Applies the synchronization support to the model. /// </summary> /// <param name = "model">The model.</param> /// <param name = "kernel">The kernel.</param> private void ApplySynchronization(ComponentModel model, IKernel kernel) { var options = model.ObtainProxyOptions(); model.Interceptors.Add(new InterceptorReference(typeof(SynchronizeInterceptor))); var metaInfo = metaStore.GetMetaFor(model.Implementation); if (metaInfo != null) { IInterceptorSelector userSelector = null; if (options.Selector != null) { userSelector = options.Selector.Resolve(kernel, CreationContext.CreateEmpty()); } options.Selector = new InstanceReference <IInterceptorSelector>(new SynchronizeInterceptorSelector(metaInfo, userSelector)); foreach (var reference in metaInfo.GetUniqueSynchContextReferences()) { reference.Attach(model); } } }
/// <summary> /// Sets the intercepted ComponentModel. /// </summary> /// <param name = "target">The targets ComponentModel.</param> public void SetInterceptedComponentModel(ComponentModel target) { metaInfo = metaStore.GetMetaFor(target.Implementation); }