Esempio n. 1
0
 private static Type?TryGenerateCompile(
     Type resourceHandlerClass,
     string fullyQualifiedClassName,
     string lookupTypeName,
     IList <Action> actions,
     ILogger logger)
 {
     try
     {
         return(TryGenerateCompile(
                    resourceHandlerClass,
                    ResourceDispatcherGenerator.ForMain(actions, true, logger),
                    fullyQualifiedClassName,
                    lookupTypeName));
     }
     catch
     {
         try
         {
             return(TryGenerateCompile(
                        resourceHandlerClass,
                        ResourceDispatcherGenerator.ForTest(actions, true, logger),
                        fullyQualifiedClassName,
                        lookupTypeName));
         }
         catch (Exception etest)
         {
             throw new ArgumentException($"ConfigurationResource dispatcher for {resourceHandlerClass.Name} not created for main or test because: {etest.Message}", etest);
         }
     }
 }
Esempio n. 2
0
 private static Type?TryGenerateCompile(
     Type resourceHandlerClass,
     ResourceDispatcherGenerator generator,
     string fullyQualifiedClassName,
     string lookupTypeName)
 {
     try
     {
         var result = generator.GenerateFor(resourceHandlerClass);
         var input  = new Input(resourceHandlerClass, fullyQualifiedClassName, lookupTypeName, result.Source, result.SourceFile, ClassLoader, generator.Type, true);
         var resourceDispatcherClass = DynaCompiler.Compile(input);
         return(resourceDispatcherClass);
     }
     catch (Exception e)
     {
         throw new ArgumentException($"ConfigurationResource instance with dispatcher for {resourceHandlerClass.Name} not created because: {e.Message}", e);
     }
 }