【发布时间】:2021-01-07 18:12:25
【问题描述】:
我正在使用 RepoDB 连接 SQL Server 数据库,我想忽略我的对象的特定属性,但我没有找到如何做到这一点。
这里有一个我想要的例子。
*这不是真实的场景......
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