使用Telosys C# Bundle生成Product模型失败求助
Telosys C# Bundle生成模型时$entity属性解析失败问题
我通过Product.entity文件,使用Telosys的C# Bundle生成模型时遇到以下问题:
核心问题
$entity.name解析失败:生成的类名是空值,无法解析为Product;$entity.fields报错:提示“No attribute 'fields'”,但Product.entity文件格式完全合法;
现状总结
系统已识别到Product实体(日志显示Entities: . Product),但$entity对象未被正确初始化,其name和fields属性均无法正常访问。该问题在Telosys 4.1.1-001和4.2.0-001版本中均存在。
使用#foreach循环时的具体报错:
[ERROR] Invalid reference (entity_cs.vm line 4) $entity.fields : no attribute 'fields'
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.entity文件内容
Product { Id : int { @Id }; Name : string; Price : decimal; IsAvailable : boolean; }
内容的提问来源于stack exchange,提问作者saibin
相关产品推荐
相关产品推荐

