コード例 #1
0
        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;
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }