public static HistoryObjectDesc AddClass(Type type) { var desc = new HistoryObjectDesc (type); ObjectsDesc.Add (desc); return desc; }
public static string ResolveFieldNameFromPath(string path, bool cutClass = true) { string result = String.Empty; string[] parts = Regex.Split (path, @"\.(.*\[.*\]|.+)(?:\.|$)"); if (parts.Length <= 0) return result; var desc = ObjectsDesc.Find (d => d.ObjectName == parts [0]); System.Type classType = desc != null ? desc.ObjectType : FineClass (parts [0]); if (desc == null && classType != null) desc = new HistoryObjectDesc (classType); if (!cutClass) { if (desc != null) result = desc.DisplayName + FieldNameSeparator; else result = parts [0] + FieldNameSeparator; } if (classType == null) for (int i = 1; i < parts.Length; i++) result += parts [i] + FieldNameSeparator; else if (parts.Length > 1) { result += ResolveFieldName (classType, parts.Where ((val, idx) => idx != 0).ToArray ()); } return result.TrimEnd (FieldNameSeparator.ToCharArray ()); }