【问题标题】:RepoDB - Ignore propertyRepoDB - 忽略属性
【发布时间】:2021-01-07 18:12:25
【问题描述】:

我正在使用 RepoDB 连接 SQL Server 数据库,我想忽略我的对象的特定属性,但我没有找到如何做到这一点。

RepoDB docs

这里有一个我想要的例子。
*这不是真实的场景......

public class Person{

  public int Id { get; set; }
  public string Name { get; set; }
  public int Age { get; set; }
  public string ZipCode { get; set; }
  public string Phone { get; set; }

  //[Ignore this property]
  public List<Dependant> Dependants { get; set; }
}

public class Dependant{

  public int Id { get; set; }
  public int ResponsibleId { get; set; }
  public string Name { get; set; }
  public int Age { get; set; }

}

【问题讨论】:

  • RepoDB 了解您的架构,并根据数据库中的表列投影模型属性相等性,因此,不再需要此类 [Ignore] 属性。 PS:这是早期代码的一部分,但我们在改进投影时已将其删除。
  • 谢谢@MichaelCamaraPendon 我会把你的评论作为答案发表!

标签: c# sql-server orm


【解决方案1】:

“RepoDB 了解您的架构,并且正在根据数据库中的表列投影模型属性相等性,因此,不再需要此类 [Ignore] 属性。PS:它是早期代码的一部分,但我们已删除我们改进了投影。- Michael Camara Pedon"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-11
    • 2023-03-19
    • 2011-04-13
    • 2011-07-19
    • 2013-01-18
    相关资源
    最近更新 更多