我需要为我的 Country 实体生成 C# 代码,该代码将从提供强类型参数的基实体类继承,以表示我的 PK (@id) 是 Guid 类型,它是基类上的 Id 属性具有隐式类型指导。所以我有两个问题:
telosys 中没有 Guid 类型。
如何使用通用基类类型参数定义 PK?
public class Country : Entity<Guid>
{
}
public abstract class Entity<TKey> : Entity, IEntity<TKey>
{
public virtual TKey Id { get; protected set; }
protected Entity(TKey id)
{
Id = id;
}
}
https://www.telosys.org/dsl-syntax.html
. binary
. boolean
. byte
. date
. decimal
. double
. float
. int
. long
. short
. string
. time
. timestamp
https://doc.telosys.org/dsl-model/tags
例如一个特殊的属性名称:metaproperty 我可以解析得到 $entity 继承类型的参数。我需要其他元数据。实体类作为 Id 属性。它可以是字符串、整数、长整数等
User {
metaproperty: string {#base
@Label("typed_param:Guid;name:Id;form_sections:Info section~1|Contact sec~2;display_layout:rows(n)_cols(12)")}
FirstName : string {@Label("form_section:~1;display_layout:row(1)col(1)colspan(3)")};
LastName: string {@Label("form_section:~1;display_layout:row(1)col(2)colspan(9)")};
Phone: string {@Label("form_section:~2;display_layout:row(1)col(1)colspan(12)")};
}
I need some mechanizam to display the layout of fields in the form for each property I want in view/edit screens
I can certaily generate some .json structure and add metadata there as well. Even have a GUI with drag and drop feature to define rows, cols and row or col spans.