<commit_before>﻿using DtronixModeler.Ddl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DtronixModeler.Generator {
	public class TypeTransformer {

		protected TypeTransformerType[] types;

		private string[] all_db_types = null;

		public string NetToDbType(string net_type){
			return NetType(net_type).db_type;
		}

		public TypeTransformerType NetType(string net_type) {
			return types.FirstOrDefault(type => type.net_type == net_type);
		}



		public string DbToNetType(string db_type) {
			return DbType(db_type).net_type;
		}

		public TypeTransformerType DbType(string db_type) {
			return types.FirstOrDefault(type => type.db_type == db_type);
		}

		public string[] DbTypes() {
			if (all_db_types == null) {
				List<string> final_types = new List<string>();
				foreach (var type in types) {
					if (final_types.Contains(type.db_type) == false) {
						final_types.Add(type.db_type);
					}
				}

				all_db_types = final_types.ToArray();
			}

			return all_db_types;
		}
	}
}
<commit_msg>Type transformer now (basically) handles enums.<commit_after>﻿using DtronixModeler.Ddl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DtronixModeler.Generator {
	public class TypeTransformer {

		protected TypeTransformerType[] types;

		private string[] all_db_types = null;

		public string NetToDbType(string net_type){
			var actual_net_type = NetType(net_type);

			// If this is null, then this is going to have to be an enum.
			if(actual_net_type == null) {
				actual_net_type = NetType("Int32");
			}

            return actual_net_type.db_type;
		}

		public TypeTransformerType NetType(string net_type) {
			return types.FirstOrDefault(type => type.net_type == net_type);
		}



		public string DbToNetType(string db_type) {
			return DbType(db_type).net_type;
		}

		public TypeTransformerType DbType(string db_type) {
			return types.FirstOrDefault(type => type.db_type == db_type);
		}

		public string[] DbTypes() {
			if (all_db_types == null) {
				List<string> final_types = new List<string>();
				foreach (var type in types) {
					if (final_types.Contains(type.db_type) == false) {
						final_types.Add(type.db_type);
					}
				}

				all_db_types = final_types.ToArray();
			}

			return all_db_types;
		}
	}
}

{'fraction_non_alphanumeric': 0.10537542662116041, 'fraction_numerical': 0.0008532423208191126, 'mean_word_length': 3.8651452282157677, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3389411', 'n_tokens_mistral': 925, 'n_tokens_neox': 779, 'n_words': 172}