gpt4 book ai didi

c# - 具有临时字段的 ServiceStack Ormlite 类

转载 作者:行者123 更新时间:2023-11-30 22:01:19 24 4
gpt4 key购买 nike

是否可以在 ServiceStack OrmLite POCO 类中定义临时字段来保存数据(不在表模式中)?

最佳答案

当然。您可以简单地在不属于您的架构的属性上添加 [Ignore] 属性。

From the documentation:

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
}

关于c# - 具有临时字段的 ServiceStack Ormlite 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27815038/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com