public static List <string> Fields(CodeTypeDeclaration ctd, CodeMemberField f, bool ExcludeComma, GeneratorConfiguration configuration) { List <string> code = new List <string>(); string comma = ","; if (ExcludeComma) { comma = ""; } if (configuration.DisableComments == false) { foreach (var c in f.Comments) { code.Add("///" + c); } } string props = ""; if (f.Attributes.ToString() == "Public") { props = props + "public "; } else { } props = props + ConvertTypes.SystemToBase(f.Type.BaseType) + " " + f.Name + comma; code.Add(props); return(code); }
public static Table SQLToBase(Table t, Field f, CodeTypeReference ctr, CodeMemberField cmf, CodeTypeDeclaration ctd) { try { if (ctr.BaseType.Contains("System.Collections")) { //Look for 'TypeArguments.InnerList' if (ctr.TypeArguments.Count > 0) { foreach (CodeTypeReference ctrInner in ctr.TypeArguments) { t = SQLToBase(t, f, ctrInner, cmf, ctd); f.DataType.IsList = true; f.DataType.IsNullable = false; f.OriginalName = ctrInner.BaseType; return(t); } } else { if (ctr.BaseType.Contains("System.Collections.ObjectModel")) { //Determine whether member is public or private and 'XmlIgnoreAttribute()' if (cmf.CustomAttributes.Count == 0) { t = GenerateKeyLink(t, f, ctr, cmf, ctd); f.OriginalName = ctr.BaseType; return(t); } else { if (XmlIgnoreAttributeCount(cmf.CustomAttributes) == 0) { //Maybe do something t = GenerateKeyLink(t, f, ctr, cmf, ctd); f.OriginalName = ctr.BaseType; return(t); } else { //Ignore member } } } else { } } } else if (ctr.BaseType == "System.Nullable`1") { //Iterate into lower levels foreach (CodeTypeReference ctrInner in ctr.TypeArguments) { Table tTemp = SQLToBase(t, f, ctrInner, cmf, ctd); f.DataType.IsList = true; f.DataType.IsNullable = true; return(t); } } else { if (f.Name == null || f.Name == "") { f.Name = ConvertTypes.GetNameFromCodeMemberField(cmf); } f.DataType = GetTypeByName(ctr, t.Namespace); f.OriginalName = ctr.BaseType; t.Fields.Add(f); } } catch (Exception ae) { string s = ae.ToString(); return(null); } return(t); }