예제 #1
0
파일: DI.cs 프로젝트: pusp/o2platform
 static DI()
 {
     log = PublicDI.log;            
     config = new KO2Config();
     reflection = new KReflection();
     showMdbgDebugMessages = false;
 }
예제 #2
0
파일: DI.cs 프로젝트: pusp/o2platform
 static DI()
 {
     log = new WinFormsUILog();
     config = new KO2Config();
                
     o2MessageQueue = KO2MessageQueue.getO2KernelQueue();
 }
예제 #3
0
        private static void applyO2ConfigDependeciesInjection(KO2Config kO2Config)
        {

            if (kO2Config != null && kO2Config.dependenciesInjection != null)
            {
                DI.log.info("Applying O2Config Depedency Injections");
                foreach (var dependency in kO2Config.dependenciesInjection)
                {
                    DI.log.debug("[setting dependecy injection]: {0}.{1} = {2}", dependency.Type, dependency.Parameter, dependency.Value);
                    var targetType = DI.reflection.getType(dependency.Type);
                    if (targetType == null)
                        DI.log.error(" [in applyO2ConfigDependeciesInjection]  Could not get type: {0}", dependency.Type);
                    else
                    {
                        var propertyInfo = DI.reflection.getPropertyInfo(dependency.Parameter, targetType);
                        if (propertyInfo == null)
                            DI.log.error(" [in applyO2ConfigDependeciesInjection]  Could not get property {0} from type: {1}", dependency.Parameter,  dependency.Type);
                        else
                        {
                            if (false == DI.reflection.setProperty(propertyInfo, dependency.Value))                             
                                DI.log.error(" [in applyO2ConfigDependeciesInjection]  Could not set property {0} from type: {1} with value {2}",
                                     dependency.Parameter,  dependency.Type, dependency.Value);                                                        
                        }
                    }

                }
            }
                
        }
예제 #4
0
파일: DI.cs 프로젝트: pusp/o2platform
        static DI()
        {
            config = new KO2Config();   // need to use local copy
            log = PublicDI.log;

            reflection = PublicDI.reflection;                        
                       
        }
예제 #5
0
파일: DI.cs 프로젝트: pusp/o2platform
 static DI()
 {
     log = PublicDI.log;
     config = new KO2Config();
     reflection = new KReflection();
 }
예제 #6
0
        public static void mergeO2ConfigFiles(KO2Config source, KO2Config target)
        {
            if (source!=null & target!=null)
            {
                foreach (var property in DI.reflection.getProperties(source))
                {
                    var sourceValue = DI.reflection.getProperty(property.Name, source,false);
                    if (sourceValue != null)
                    {
                        switch (property.Name)
                        {        
                            case "dependenciesInjection":
                                var sourceDependenciesInjection = (List<DependencyInjection>)DI.reflection.getProperty(property.Name, source);
                                var targetDependenciesInjection = (List<DependencyInjection>)DI.reflection.getProperty(property.Name, target);
                                targetDependenciesInjection.AddRange(sourceDependenciesInjection);
                                break;
                            case "dependencyInjectionTest":         // we don't want this to be set from here (and it couldn't be anyway since it is static)
                                KO2Config.dependencyInjectionTest = "";
                                break;
                            default:
                                DI.reflection.setProperty(property.Name, target, sourceValue);
                                break;
                        }
                    }
                }

            }
            else
                DI.log.error("in mergeO2ConfigFiles false == (source!=null & target!=null)");
        }
예제 #7
0
 private static void saveO2ConfigFile(KO2Config o2ConfigFileToSave, string path)
 {
     O2Kernel_Serialize.createSerializedXmlFileFromObject(o2ConfigFileToSave, path, null);
 }
예제 #8
0
 public static KO2Config createO2ConfigFile(string pathToO2ConfigFile)
 {
     var newO2ConfigFile = new KO2Config(pathToO2ConfigFile);
     saveO2ConfigFile(newO2ConfigFile, pathToO2ConfigFile);
     return newO2ConfigFile;
 }