public List<FeatureInfo> GetBindingInformations(INinjectModule module) { List<FeatureInfo> bindingsFeatureInfoList = new List<FeatureInfo>(); IKernel kernel = new StandardKernel(); module.OnLoad(kernel); List<KeyValuePair<Type, ICollection<IBinding>>> typeBindingInfo = GetBindings(kernel, module.Name); foreach (KeyValuePair<Type, ICollection<IBinding>> typeBinding in typeBindingInfo) { FeatureInfo bindingInterface = new FeatureInfo(typeBinding.Key, null, null, FeatureType.BindingInterface); foreach (IBinding binding in typeBinding.Value) { ContextMock contextMock = new ContextMock(kernel); IProvider provider = binding.ProviderCallback(contextMock); FeatureInfo bindingInterfaceImpl = new FeatureInfo(provider.Type, null, null, FeatureType.BindingImpl); bindingInterfaceImpl.SetBindingType(binding.Target); bindingInterface.AddDependency(bindingInterfaceImpl); } bindingsFeatureInfoList.Add(bindingInterface); } return bindingsFeatureInfoList; }
private void GetNeededExtensions(Feature ninjectFeature, FeatureInfo featureInfo) { List<INinjectModule> neededExtensionList = ninjectFeature.NeededExtensions.ToList(); foreach (INinjectModule neededExtension in neededExtensionList) { FeatureInfo needExtensionInfo = new FeatureInfo(neededExtension.GetType(), null, null, FeatureType.NeededExtensions); needExtensionInfo.AddDependency(this.bindingReader.GetBindingInformations(neededExtension)); featureInfo.AddDependency(needExtensionInfo); } }
private void GetModules(Feature ninjectFeature, FeatureInfo featureInfo) { List<INinjectModule> moduleList = ninjectFeature.Modules.ToList(); foreach (INinjectModule module in moduleList) { FeatureInfo moduleInfo = new FeatureInfo(module.GetType(), null, null, FeatureType.Module); moduleInfo.AddDependency(this.bindingReader.GetBindingInformations(module)); featureInfo.AddDependency(moduleInfo); } }
private void GetNeededFeatures(Feature ninjectFeature, FeatureInfo featureInfo) { IList<Feature> neededFeatureList = ninjectFeature.NeededFeatures.ToList(); foreach (Feature neededFeature in neededFeatureList) { FeatureInfo needfeatureInfo = ProcessFeatureInstance(neededFeature.GetType()); needfeatureInfo.ChangeFeatureType(FeatureType.NeededFeature); featureInfo.AddDependency(needfeatureInfo); } }