admin管理员组文章数量:1400109
I am trying to generate model from Product.entity using C# bundle.
Key Insight $entity.name Fails: It’s not resolving to Product—the class name was blank in the minimal output. $entity.fields Fails: “No attribute 'fields'” persists, even with a valid Product.entity. Conclusion: The $entity object isn’t being populated correctly—neither name nor fields works, despite Product being recognized (Entities: . Product). This isn’t just a $entity.fields issue—$entity itself is broken in the generator context for both 4.1.1-001 and 4.2.0-001.
Current Error (with #foreach): [ERROR] Invalid reference (entity_cs.vm line 4) $entity.fields : no attribute 'fields'—even in 4.1.1-001.
templates.cfg: Entity class;${BEANNAME}.cs;Models;entity_cs.vm;*
entity_cs.vm
// Generated on ${now}
namespace TelosysSample.Models {
public class ${entity.name} {
#foreach ($field in $entity.fields)
public ${field.type} ${field.name} { get; set; }
#end
}
}
Product {
Id : int { @Id };
Name : string;
Price : decimal;
IsAvailable : boolean;
}
I am trying to generate model from Product.entity using C# bundle.
Key Insight $entity.name Fails: It’s not resolving to Product—the class name was blank in the minimal output. $entity.fields Fails: “No attribute 'fields'” persists, even with a valid Product.entity. Conclusion: The $entity object isn’t being populated correctly—neither name nor fields works, despite Product being recognized (Entities: . Product). This isn’t just a $entity.fields issue—$entity itself is broken in the generator context for both 4.1.1-001 and 4.2.0-001.
Current Error (with #foreach): [ERROR] Invalid reference (entity_cs.vm line 4) $entity.fields : no attribute 'fields'—even in 4.1.1-001.
templates.cfg: Entity class;${BEANNAME}.cs;Models;entity_cs.vm;*
entity_cs.vm
// Generated on ${now}
namespace TelosysSample.Models {
public class ${entity.name} {
#foreach ($field in $entity.fields)
public ${field.type} ${field.name} { get; set; }
#end
}
}
Product {
Id : int { @Id };
Name : string;
Price : decimal;
IsAvailable : boolean;
}
Share
Improve this question
edited Mar 24 at 11:56
saibin
asked Mar 24 at 11:56
saibinsaibin
254 bronze badges
1 Answer
Reset to default 1You get the error "$entity.fields : no attribute 'fields'"
because indeed "fields" is not a property of "$entity".
You should use "$entity.attributes" instead.
See the documentation for Telosys objects here : https://doc.telosys./bundles/telosys-objects
Example:
#foreach ($attr in $entity.attributes)
public ${attr.type} ${attr.name} { get; set; }
#end
$entity.name should always work except if there's an error in your template definition in "templates.cfg" with a line ending with "1" (no entity) instead of "*" (for each entity)
本文标签: telosys is not generating model using csharp bundleStack Overflow
版权声明:本文标题:telosys is not generating model using csharp bundle - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744254229a2597399.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论