Servicestack OrmLite 忽略插入更新 - POCO
Servicestack OrmLite Ignore insert update - POCO
是否有任何属性为 SELECT 设置了 POCO 字段。
类似下面的内容;
public class Poco {
public string Id { get; set; }
public string Name { get; set; }
[IgnoreUpdate]
public Datetime CreatedOn{ get; set; }
[IgnoreInsert]
public Datetime UpdateOn{ get; set; }
}
OrmLite [Ignore]
完全忽略 属性,[IgnoreOnInsert]
在插入期间忽略 属性,[IgnoreOnUpdate]
忽略 属性 更新期间。
另一种解决方案是为 SELECT 使用不同的模型,您可以在其中使用 [Alias]
属性将其映射回原始表名,例如
[Alias("Poco")]
public class PocoDetails
{
public string Id { get; set; }
public string Name { get; set; }
public Datetime CreatedOn{ get; set; }
public Datetime UpdateOn{ get; set; }
}
只是小更新 - 在当前版本的 ServiceStack v5 中,可以使用属性 [IgnoreOnInsert]
、[IgnoreOnUpdate]
或 [IgnoreOnSelect]
来标记 属性
是否有任何属性为 SELECT 设置了 POCO 字段。
类似下面的内容;
public class Poco {
public string Id { get; set; }
public string Name { get; set; }
[IgnoreUpdate]
public Datetime CreatedOn{ get; set; }
[IgnoreInsert]
public Datetime UpdateOn{ get; set; }
}
OrmLite [Ignore]
完全忽略 属性,[IgnoreOnInsert]
在插入期间忽略 属性,[IgnoreOnUpdate]
忽略 属性 更新期间。
另一种解决方案是为 SELECT 使用不同的模型,您可以在其中使用 [Alias]
属性将其映射回原始表名,例如
[Alias("Poco")]
public class PocoDetails
{
public string Id { get; set; }
public string Name { get; set; }
public Datetime CreatedOn{ get; set; }
public Datetime UpdateOn{ get; set; }
}
只是小更新 - 在当前版本的 ServiceStack v5 中,可以使用属性 [IgnoreOnInsert]
、[IgnoreOnUpdate]
或 [IgnoreOnSelect]