带有临时字段的 ServiceStack Ormlite class
ServiceStack Ormlite class with temporary field
是否可以在 ServiceStack OrmLite POCO 类中定义临时字段来保存数据(不在 table 模式中)?
当然可以。您可以简单地在不属于您的架构的属性上添加 [Ignore]
属性。
Ignoring DTO Properties
You may use the [Ignore] attribute to denote DTO properties that are not fields in the table. This will force the SQL generation to ignore that property.
示例:
public class MyTable
{
public int Id { get; set; }
public string Name { get; set; }
[Ignore]
public string ExtraData { get; set; } // This field will not be included in SQL
}
是否可以在 ServiceStack OrmLite POCO 类中定义临时字段来保存数据(不在 table 模式中)?
当然可以。您可以简单地在不属于您的架构的属性上添加 [Ignore]
属性。
Ignoring DTO Properties
You may use the [Ignore] attribute to denote DTO properties that are not fields in the table. This will force the SQL generation to ignore that property.
示例:
public class MyTable
{
public int Id { get; set; }
public string Name { get; set; }
[Ignore]
public string ExtraData { get; set; } // This field will not be included in SQL
}