Exemplo n.º 1
0
        public bool Run(string assemblyName, List <string> files)
        {
            List <ClassAttributes> classAttributesList = new List <ClassAttributes>();

            foreach (string file in files)
            {
                _fileConfiguration.FileName = file;
                foreach (string workSheet in _excelRepository.GetWorkSheetNames())
                {
                    ClassAttributes classAttributes = _excelRepository.GetDTOClassAttributes(workSheet);
                    classAttributes.Namespace = String.Format("{0}.{1}", assemblyName, Path.GetFileNameWithoutExtension(file));

                    if (classAttributes.Properties.Count == 0)
                    {
                        continue;
                    }
                    _classGenerator.Create(classAttributes);
                    classAttributesList.Add(classAttributes);
                }
            }
            return((classAttributesList.Count > 0) &&
                   _assemblyGenerator.Compile(classAttributesList.Select(x => x.FullName).ToArray(), new AssemblyAttributes(assemblyName)));
        }