private Tuple <TView, object> GetContext <TView>(IBinding binding) { object viewModel = null; TView view = _implementor.CreateInstance <TView>(binding.BindingType, binding.BindingConstructorArguments, binding.BindingAdditionalArguments); if (binding.InstanceScopeType == InstanceScopeType.Singleton && binding.Instance != null) { viewModel = binding.Instance; } else { viewModel = _implementor.CreateInstance(binding.ServiceType, binding.ServiceConstructorArguments, binding.ServiceAdditionalArguments); Type viewModelType = viewModel.GetType(); if (Attribute.IsDefined(viewModelType, typeof(ControllerPageAttribute))) { var pageBindings = viewModelType.GetCustomAttributes <ControllerPageAttribute>() .Select(x => GetBinding(x.PageType)); } if (binding.InstanceScopeType == InstanceScopeType.Singleton) { binding.Instance = viewModel; } } return(new Tuple <TView, object>(view, viewModel)); }
public TImplementation ResolveInterface <TImplementation>() { return(_implementor.CreateInstance <TImplementation>()); }