示例#1
0
 public ExcelToDTOMapper(IRepository excelRepository, IClassGenerator classGenerator, IAssemblyGenerator assemblyGenerator, IFileConfiguration fileConfiguration)
 {
     _excelRepository   = excelRepository;
     _classGenerator    = classGenerator;
     _assemblyGenerator = assemblyGenerator;
     _fileConfiguration = fileConfiguration;
 }
示例#2
0
 public ExcelToDTOMapper(IRepository excelRepository, IClassGenerator classGenerator, IAssemblyGenerator assemblyGenerator, IFileConfiguration fileConfiguration)
 {
     _excelRepository = excelRepository;
     _classGenerator = classGenerator;
     _assemblyGenerator = assemblyGenerator;
     _fileConfiguration = fileConfiguration;
 }
示例#3
0
 public ODataGenerator(
     IPluginsContainer <IODataGeneratorPlugin> plugins,
     ICodeGenerator codeGenerator,
     IAssemblyGenerator assemblyGenerator
     )
 {
     _plugins           = plugins;
     _codeGenerator     = codeGenerator;
     _assemblyGenerator = assemblyGenerator;
 }
示例#4
0
 /// <summary>
 /// If assemblyName is not null, the assembly will be saved on disk.
 /// If assemblyName is null, the assembly will be generated in memory.
 /// </summary>
 public DomGenerator(
     IPluginsContainer <IConceptCodeGenerator> plugins,
     ICodeGenerator codeGenerator,
     ILogProvider logProvider,
     IAssemblyGenerator assemblyGenerator)
 {
     _pluginRepository = plugins;
     _codeGenerator    = codeGenerator;
     _log = logProvider;
     _assemblyGenerator = assemblyGenerator;
 }
 public JavaScriptModelGenerator(
     IPluginsContainer <IJavascriptModelGeneratorPlugin> plugins,
     ICodeGenerator codeGenerator,
     IAssemblyGenerator assemblyGenerator,
     ILogProvider logProvider)
 {
     _plugins           = plugins;
     _codeGenerator     = codeGenerator;
     _assemblyGenerator = assemblyGenerator;
     _performanceLogger = logProvider.GetLogger("Performance");
 }
 public MvcModelGenerator(
     IPluginsContainer<IMvcModelGeneratorPlugin> plugins,
     ICodeGenerator codeGenerator,
     IAssemblyGenerator assemblyGenerator,
     ILogProvider logProvider
     )
 {
     _plugins = plugins;
     _codeGenerator = codeGenerator;
     _assemblyGenerator = assemblyGenerator;
     _performanceLogger = logProvider.GetLogger("Performance");
 }
示例#7
0
 /// <summary>
 /// If assemblyName is not null, the assembly will be saved on disk.
 /// If assemblyName is null, the assembly will be generated in memory.
 /// </summary>
 public DomGenerator(
     IPluginsContainer <IConceptCodeGenerator> plugins,
     ICodeGenerator codeGenerator,
     IAssemblyGenerator assemblyGenerator,
     RhetosBuildEnvironment buildEnvironment,
     ISourceWriter sourceWriter)
 {
     _pluginRepository  = plugins;
     _codeGenerator     = codeGenerator;
     _assemblyGenerator = assemblyGenerator;
     _buildEnvironment  = buildEnvironment;
     _sourceWriter      = sourceWriter;
 }
示例#8
0
 /// <summary>
 /// If assemblyName is not null, the assembly will be saved on disk.
 /// If assemblyName is null, the assembly will be generated in memory.
 /// </summary>
 public DomGenerator(
     IPluginsContainer<IConceptCodeGenerator> plugins,
     ICodeGenerator codeGenerator,
     ILogProvider logProvider,
     IAssemblyGenerator assemblyGenerator,
     DomGeneratorOptions domGeneratorOptions)
 {
     _domGeneratorOptions = domGeneratorOptions;
     _pluginRepository = plugins;
     _codeGenerator = codeGenerator;
     _log = logProvider;
     _assemblyGenerator = assemblyGenerator;
 }
示例#9
0
        public IEnumerable <string> Dependencies => new[] { "Rhetos.Deployment.ResourcesGenerator" }; // Required since Rhetos v4.1, because at build-time it uses files from the generated Resources folder.

        public Angular2ModelGenerator(
            IPluginsContainer <IAngular2ModelGeneratorPlugin> plugins,
            ICodeGenerator codeGenerator,
            IAssemblyGenerator assemblyGenerator,
            ILogProvider logProvider
            )
        {
            _plugins           = plugins;
            _codeGenerator     = codeGenerator;
            _assemblyGenerator = assemblyGenerator;
            _performanceLogger = logProvider.GetLogger("Performance");
            _logger            = logProvider.GetLogger(GetType().Name);
        }
示例#10
0
 /// <summary>
 /// If assemblyName is not null, the assembly will be saved on disk.
 /// If assemblyName is null, the assembly will be generated in memory.
 /// </summary>
 public DomGenerator(
     IPluginsContainer<IConceptCodeGenerator> plugins,
     ICodeGenerator codeGenerator,
     ILogProvider logProvider,
     IAssemblyGenerator assemblyGenerator,
     string assemblyName)
 {
     _assemblyName = assemblyName;
     _pluginRepository = plugins;
     _codeGenerator = codeGenerator;
     _log = logProvider;
     _assemblyGenerator = assemblyGenerator;
 }
 public CaptionsResourceGenerator(
     IPluginsContainer<ICaptionsResourceGeneratorPlugin> plugins,
     CaptionsInitialCodePlugin initialCodePlugin,
     ICodeGenerator codeGenerator,
     IAssemblyGenerator assemblyGenerator,
     ILogProvider logProvider)
 {
     _plugins = plugins;
     _initialCodePlugin = initialCodePlugin;
     _codeGenerator = codeGenerator;
     _assemblyGenerator = assemblyGenerator;
     _logger = logProvider.GetLogger("CaptionsResourceGenerator");
     _performanceLogger = logProvider.GetLogger("Performance");
 }
示例#12
0
        public RestGenerator(
            IPluginsContainer <IRestGeneratorPlugin> plugins,
            ICodeGenerator codeGenerator,
            ILogProvider logProvider,
            IAssemblyGenerator assemblyGenerator
            )
        {
            _plugins           = plugins;
            _codeGenerator     = codeGenerator;
            _assemblyGenerator = assemblyGenerator;

            _logger       = logProvider.GetLogger("RestGenerator");
            _sourceLogger = logProvider.GetLogger("Rest service");
        }
示例#13
0
        public RestGenerator(
            IPluginsContainer<IRestGeneratorPlugin> plugins,
            ICodeGenerator codeGenerator,
            ILogProvider logProvider,
            IAssemblyGenerator assemblyGenerator
            )
        {
            _plugins = plugins;
            _codeGenerator = codeGenerator;
            _assemblyGenerator = assemblyGenerator;

            _logger = logProvider.GetLogger("RestGenerator");
            _sourceLogger = logProvider.GetLogger("Rest service");
        }
示例#14
0
            public void SetUp()
            {
                _excelRepository = MockRepository.GenerateMock<IRepository>();
                _classGenerator = MockRepository.GenerateMock<IClassGenerator>();
                _assemblyGenerator = MockRepository.GenerateMock<IAssemblyGenerator>();
                _fileConfiguration = MockRepository.GenerateMock<IFileConfiguration>();
                _excelToDtoMapper = new ExcelToDTOMapper(_excelRepository, _classGenerator, _assemblyGenerator,
                                                         _fileConfiguration);

                _excelFiles = new List<string>
                                  {
                                      "TestExcel.xls"
                                  };
                _workSheetNames = new List<string>
                                      {
                                          "Test1$",
                                          "Test2$"
                                      };
                _classAttributes1 = new ClassAttributes("Test1");
                _classAttributes2 = new ClassAttributes("Test2");
            }
示例#15
0
            public void SetUp()
            {
                _excelRepository   = MockRepository.GenerateMock <IRepository>();
                _classGenerator    = MockRepository.GenerateMock <IClassGenerator>();
                _assemblyGenerator = MockRepository.GenerateMock <IAssemblyGenerator>();
                _fileConfiguration = MockRepository.GenerateMock <IFileConfiguration>();
                _excelToDtoMapper  = new ExcelToDTOMapper(_excelRepository, _classGenerator, _assemblyGenerator,
                                                          _fileConfiguration);

                _excelFiles = new List <string>
                {
                    "TestExcel.xls"
                };
                _workSheetNames = new List <string>
                {
                    "Test1$",
                    "Test2$"
                };
                _classAttributes1 = new ClassAttributes("Test1");
                _classAttributes2 = new ClassAttributes("Test2");
            }
示例#16
0
 public PlayerComboBoxItem(string playerName, IAssemblyGenerator playerGenerator)
 {
     this.playerName      = playerName;
     this.playerGenerator = playerGenerator;
 }
示例#17
0
 public PlayerComboBoxItem(string playerName, IAssemblyGenerator playerGenerator)
 {
     this.playerName = playerName;
     this.playerGenerator = playerGenerator;
 }
示例#18
0
        public void CompileAll(IAssemblyGenerator generator)
        {
            foreach (var assemblyReference in this._assemblies)
            {
                generator.ReferenceAssembly(assemblyReference);
            }

            foreach (var generatedType in this.GeneratedTypes)
            {
                foreach (var x in generatedType.AssemblyReferences())
                {
                    generator.ReferenceAssembly(x);
                }

                // We generate the code for the type upfront as we allow adding namespaces etc. during the rendering of
                // frames so we need to do those, and _then_ gather namespaces
                // A rough estimate of 3000 characters per method with 2 being used, plus 1000 for ctor.
                var typeWriter = new SourceWriter((3000 * 2) + 1000);
                generatedType.Write(typeWriter);

                var namespaces = generatedType
                                 .AllInjectedFields
                                 .Select(x => x.VariableType.Namespace)
                                 .Concat(new[] { typeof(Task).Namespace })
                                 .Concat(generatedType.Namespaces)
                                 .Distinct()
                                 .ToList();

                var writer = new SourceWriter();

                writer.Comment("<auto-generated />");
                writer.Comment(generatedType.TypeName);
                writer.BlankLine();

                foreach (var ns in namespaces.OrderBy(x => x))
                {
                    writer.UsingNamespace(ns);
                }

                writer.BlankLine();

                writer.Namespace(generatedType.Namespace);

                writer.WriteLines(typeWriter.Code());

                writer.FinishBlock();

                var code = writer.Code();

                generatedType.SourceCode = code;
                generator.AddFile($"{generatedType.Namespace.Replace(".", "/")}/{generatedType.TypeName}.cs", code);
            }

            var assembly = generator.Generate(this._generationRules);

            var generated = assembly.GetExportedTypes().ToArray();

            foreach (var generatedType in this.GeneratedTypes)
            {
                generatedType.FindType(generated);
            }
        }
示例#19
0
        /// <summary>
        /// Get the generated assembly for the specified fileName using the
        /// specified generator to generate it if necessary
        /// </summary>
        /// <param name="infoFileName"></param>
        /// <param name="generator"></param>
        /// <returns></returns>
        public static GeneratedAssemblyInfo GetGeneratedAssembly(string infoFileName, IAssemblyGenerator generator)
        {
            GeneratedAssemblyInfo assemblyInfo = GeneratedAssemblies.GetGeneratedAssemblyInfo(infoFileName);

            if (assemblyInfo == null)
            {
                assemblyInfo = new GeneratedAssemblyInfo(infoFileName);
                // check for the info file
                if (assemblyInfo.InfoFileExists) // load it from file if it exists
                {
                    assemblyInfo = assemblyInfo.InfoFilePath.FromJsonFile <GeneratedAssemblyInfo>();
                    if (!assemblyInfo.InfoFileName.Equals(infoFileName) || !assemblyInfo.AssemblyExists) // regenerate if the names don't match
                    {
                        assemblyInfo = generator.GenerateAssembly();
                    }
                }
                else
                {
                    assemblyInfo = generator.GenerateAssembly();
                }
            }

            GeneratedAssemblies.SetAssemblyInfo(infoFileName, assemblyInfo);
            return(assemblyInfo);
        }