public static IEnumerable <Type> GetTableTypes(string tableName, Action <MySqlClassGenerator> additionalProcessing = null) { IEnumerable <GeneratedTableCode> codeItems; // Generate using (var generator = TestDb.CreateMySqlClassGenerator()) { if (additionalProcessing != null) { additionalProcessing(generator); } generator.TablesToGenerate = new string[] { tableName }; codeItems = generator.Generate(GeneratedNamespace, GeneratedNamespace); codeItems = codeItems.Where(x => x.CodeType != GeneratedCodeType.ClassDbExtensions); codeItems = codeItems.Where( x => x.Table == tableName || x.CodeType == GeneratedCodeType.ColumnMetadata || x.CodeType == GeneratedCodeType.ColumnCollectionClass).ToImmutable(); } // Get the temp files and write the code to them var tempFiles = new List <string>(codeItems.Count()); ScriptTypeCollection ret; try { foreach (var item in codeItems) { var tempFile = Path.GetTempFileName() + ".cs"; tempFiles.Add(tempFile); File.WriteAllText(tempFile, item.Code); } // Generate assembly ret = new ScriptTypeCollection("testdb_table_" + tableName, tempFiles); } finally { // Delete the temp files foreach (var file in tempFiles) { if (File.Exists(file)) { File.Delete(file); } } } return(ret); }