public static void GenerateDbTableFieldDescribe(Type[] types, string codeDir) { GetAllFilesInDirectory(codeDir); if (listFiles.Count > 0) { IList <PropertyDoc> list = new List <PropertyDoc>(); foreach (var fileInfo in listFiles) { string FileName = Path.GetFileNameWithoutExtension(fileInfo.FullName); string filePath = fileInfo.FullName; Type temp = null; foreach (Type type in types) { //类名与文件名相等 if (type.Name == FileName) { temp = type; break; } } if (temp != null) { var parser = new PropertyDocParser(); parser.Types = types; parser.TypeContext = temp; parser.ClassContent = System.IO.File.ReadAllText(filePath, System.Text.Encoding.Default); IList <PropertyDoc> item = parser.Parse(); Console.WriteLine(FileName); if (!string.IsNullOrWhiteSpace(parser.Comment)) { if (DbHelper.IsTableDec(FileName)) { DbHelper.ExtendedProperty(true, parser.Comment, FileName, ""); } else { DbHelper.ExtendedProperty(false, parser.Comment, FileName, ""); } } foreach (var pd in item) { if (pd.Comment.Length > 0) { if (DbHelper.IsProperty(FileName, pd.PropertyName)) { DbHelper.ExtendedProperty(true, pd.Comment, FileName, pd.PropertyName); } else { DbHelper.ExtendedProperty(false, pd.Comment, FileName, pd.PropertyName); } } Console.WriteLine(pd.ToString()); } Console.WriteLine("============================================"); } } } }
public static void GenerateDbTableFieldDescribe(Type[] types, string codeDir) { GetAllFilesInDirectory(codeDir); if (listFiles.Count > 0) { IList<PropertyDoc> list = new List<PropertyDoc>(); foreach (var fileInfo in listFiles) { string FileName = Path.GetFileNameWithoutExtension(fileInfo.FullName); string filePath = fileInfo.FullName; Type temp = null; foreach (Type type in types) { //类名与文件名相等 if (type.Name == FileName) { temp = type; break; } } if (temp != null) { var parser = new PropertyDocParser(); parser.Types = types; parser.TypeContext = temp; parser.ClassContent = System.IO.File.ReadAllText(filePath, System.Text.Encoding.Default); IList<PropertyDoc> item = parser.Parse(); Console.WriteLine(FileName); if (!string.IsNullOrWhiteSpace(parser.Comment)) { if (DbHelper.IsTableDec(FileName)) { DbHelper.ExtendedProperty(true, parser.Comment, FileName, ""); } else { DbHelper.ExtendedProperty(false, parser.Comment, FileName, ""); } } foreach (var pd in item) { if (pd.Comment.Length > 0) { if (DbHelper.IsProperty(FileName, pd.PropertyName)) { DbHelper.ExtendedProperty(true, pd.Comment, FileName, pd.PropertyName); } else { DbHelper.ExtendedProperty(false, pd.Comment, FileName, pd.PropertyName); } } Console.WriteLine(pd.ToString()); } Console.WriteLine("============================================"); } } } }