예제 #1
0
        private void Execute(RhinoEtlCommandLineOptions options)
        {
            RhinoEtlRunner.SetupLogging(options.Verbose);

            log.DebugFormat("Starting with {0}", options.File);
            try
            {
                string ext = Path.GetExtension(options.File).ToLower();
                Type   processType;
                if (ext == ".exe" || ext == ".dll")
                {
                    processType = GetFromAssembly(options);
                }
                else
                {
                    processType = GetFromDslFile(options.File);
                }

                ExecuteProcessInSeparateAppDomain(processType, options);
            }
            catch (Exception e)
            {
                log.Debug(e);
                log.Error(e.Message);
            }
        }
예제 #2
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         appDomainSetup.ApplicationBase   = _assemblyInfo.DirectoryName;
         appDomainSetup.ConfigurationFile = options.File + ".config";
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof(RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof(RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }
예제 #3
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         //setting this to the current executing directory because that's where the dsl's dll gets created.
         appDomainSetup.ApplicationBase   = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
         appDomainSetup.ConfigurationFile = string.IsNullOrEmpty(options.Configuration) ? options.File + ".config" : options.Configuration;
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof(RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof(RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }