public static string GetCSharpModelShortName(TransportModelItem item, ModelType modelType) { var name = modelType == ModelType.Transport ? item.Name : $"St{item.Name}"; if (item is TransportModelInterface) { return($"I{name}"); } return(name); }
public static bool TypeInherits(TransportModelItem parent, TransportModelItem child) { if (parent == child) { return(true); } if (parent is TransportModelInterface parentInterface) { if (child is TransportModelEntity childEntity) { return(childEntity.Interfaces.Any(i => TypeInherits(parent, i)) || (childEntity.BaseEntity != null && TypeInherits(parent, childEntity.BaseEntity.TransportModelItem))); } else { if (child is TransportModelInterface childInerface) { return(childInerface.Interfaces.Any(i => TypeInherits(parent, i))); } } } else { if (parent is TransportModelEntity parentEntity) { if (child is TransportModelEntity childEntity) { return(childEntity.BaseEntity != null && TypeInherits(parent, childEntity.BaseEntity.TransportModelItem)); } else { if (child is TransportModelInterface childInerface) { return(false); } } } } return(false); }
public static string GetCSharpModelFullyQualifiedName(TransportModelItem item, Settings settings, ModelType modelType) { var modelNamespace = modelType == ModelType.Transport ? settings.CsTransportModelNamespace : settings.CsAstModelNamespace; return($"{modelNamespace}.{GetCSharpModelShortName(item, modelType)}"); }