示例#1
0
        internal IDBRampUpModule LoadModule(DBRampUpModuleConfiguration moduleConfig)
        {
            string typeName = null;

            IDBRampUpModule module = null;

            try
            {
                Type type = Type.GetType(moduleConfig.TypeName);

                if (type == null)
                {
                    throw new ApplicationException(String.Format("A DBRampUpModule could not be loaded. The type {0} does not exist", moduleConfig.TypeName));
                }
                else
                {
                    module = Activator.CreateInstance(type) as IDBRampUpModule;

                    if (module == null)
                    {
                        WriteLine(String.Format("A DBRampUpModule could not be loaded. The type {0} could not be instantiated", typeName));
                    }
                    else
                    {
                        // Initialize the extender
                        module.Initialize(context);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLine(String.Format("A DBRampUpModule could not be loaded. An exception of type {0} occurred: {1}", ex.GetType().Name, ex.Message));
            }

            // Return the result
            return(module);
        }
示例#2
0
        internal IDBRampUpModule LoadModule(DBRampUpModuleConfiguration moduleConfig)
        {
            string typeName = null;

            IDBRampUpModule module = null;

            try
            {

                Type type = Type.GetType(moduleConfig.TypeName);

                if (type == null)
                {
                    throw new ApplicationException(String.Format("A DBRampUpModule could not be loaded. The type {0} does not exist", moduleConfig.TypeName));
                }
                else
                {
                    module = Activator.CreateInstance(type) as IDBRampUpModule;

                    if (module == null)
                    {
                        WriteLine(String.Format("A DBRampUpModule could not be loaded. The type {0} could not be instantiated", typeName));
                    }
                    else
                    {
                        // Initialize the extender
                        module.Initialize(context);
                    }
                }

            }
            catch (Exception ex)
            {
                WriteLine(String.Format("A DBRampUpModule could not be loaded. An exception of type {0} occurred: {1}", ex.GetType().Name, ex.Message));
            }

            // Return the result
            return module;
        }