示例#1
0
        public string GenerateRefAttribute(CoreRefAttribute attr, CoreInterface ifa, CoreModel model)
        {
            string code  = $"ref  {attr.ReferencedInterface.Name}.{attr.ReferencedAttribute.Name}".Indent(1);
            bool   dirty = false;

            if (attr.IsPrimaryKey)
            {
                dirty = true;
                code += "(primary_key=\"true\"";
            }
            if (attr.IsCalculated)
            {
                if (!dirty)
                {
                    code += "(";
                }
                else
                {
                    code += ", ";
                }
                dirty = true;
                code += "calculated=\"true\"";
            }
            if (!String.IsNullOrEmpty(attr.FormerName))
            {
                if (!dirty)
                {
                    code += "(";
                }
                else
                {
                    code += ", ";
                }
                dirty = true;
                code += $"former_name=\"{attr.FormerName}\"";
            }
            if (dirty)
            {
                code += ")";
            }
            if (!string.IsNullOrEmpty(attr.Alias))
            {
                code += $" as {attr.Alias}";
            }
            code += ";\n";
            return(code);
        }
示例#2
0
 public RefBLAttribute(CoreRefAttribute coreAttribute, IBLInterface parentInterface)
 {
     this.coreAttribute   = coreAttribute;
     this.ParentInterface = parentInterface;
 }