public static string GenerateFormView(IFieldCollection fields) { Debug.Assert(fields != null); Func <FieldType, bool> isBigFieldDlg = (FieldType ft) => ft == FieldType.OneToMany || ft == FieldType.ManyToMany || ft == FieldType.Text; var smallFields = from f in fields where !AbstractSqlModel.SystemReadonlyFields.Contains(f.Key) && !f.Value.Name.StartsWith("_") && !isBigFieldDlg(f.Value.Type) select f; //生成单行字段 var vb = new ViewBuilder(); vb.WriteFormStart(); foreach (var f in smallFields) { vb.WriteFieldLabel(f.Value.Name); vb.WriteField(f.Value.Name); } var bigFields = from f in fields where !AbstractSqlModel.SystemReadonlyFields.Contains(f.Key) && !f.Key.StartsWith("_") && isBigFieldDlg(f.Value.Type) select f; //生成比较占空间的字段 foreach (var f in bigFields) { vb.WriteNewLine(); vb.WriteHLine(f.Value.Label); vb.WriteNewLine(); vb.WriteField(f.Value.Name, 4, true); } vb.WriteFormEnd(); return(vb.ToString()); }