gpt4 book ai didi

c# - 使用 Dapper 值对象

转载 作者:行者123 更新时间:2023-11-30 16:16:21 26 4
gpt4 key购买 nike

我有一个带有聚合值对象的实体,如下所示:

public class Address {
public string Town { get; set; }
public string Street { get; set; }
public string Region { get; set; }
...
}

public class Contact {
public Int32 Id { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
}

我的持久性模型是一个包含以下字段的表:Id、Name、Street、Town、Region、ecc。是否可以使用 Dapper 在这种情况下创建/读取/更新/删除实体?

最佳答案

您可以使用多重映射功能。这里有一些例子:

Correct use of Multimapping in Dapper

关于c# - 使用 Dapper 值对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18505421/

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