private string GetCalculated(CoreBaseAttribute attr) { if (attr.IsCalculated) { return(" (Calculated)"); } return(""); }
private string GenerateBaseAttribute(string type, CoreBaseAttribute attr, CoreInterface ifa, CoreModel model) { var code = $"{type} {attr.Name}:{DataTypeToString(attr.DataType)}".Indent(1); if (attr.IsPrimaryKey || attr.DataType == CoreDataType.DECIMAL || attr.DataType == CoreDataType.VARCHAR || !string.IsNullOrEmpty(attr.Unit) || attr.IsCalculated) { bool dirty = false; code += "("; if (attr.IsPrimaryKey) { dirty = true; code += "primary_key=\"true\""; } if (attr.DataType == CoreDataType.DECIMAL) { if (dirty) { code += ", "; } dirty = true; code += $"len=\"{attr.Length},{attr.Decimals}\""; } if (attr.DataType == CoreDataType.VARCHAR) { if (dirty) { code += ", "; } dirty = true; code += $"len=\"{attr.Length}\""; } if (!string.IsNullOrEmpty(attr.Unit)) { if (dirty) { code += ", "; } dirty = true; code += $"unit=\"{attr.Unit}\""; } if (attr.IsCalculated) { if (dirty) { code += ", "; } dirty = true; code += "calculated=\"true\""; } if (!String.IsNullOrEmpty(attr.FormerName)) { if (dirty) { code += ", "; } dirty = true; code += $"former_name=\"{attr.FormerName}\""; } code += ")"; } code += ";\n"; return(code); }
public string GenerateFactAttribute(CoreBaseAttribute attr, CoreInterface ifa, CoreModel model) { return(GenerateBaseAttribute("fact", attr, ifa, model)); }
public BaseBLAttribute(CoreBaseAttribute coreAttribute, IBLInterface parentInterface) { this.coreAttribute = coreAttribute; this.ParentInterface = parentInterface; }