我创建了一个 Web API。我使用过 Net Core 6 和 Entity 框架。在这个方法中我想保存两个实体。StockPosition 已保存,但 StockTransaction 存在一些问题。我有一个错误:
System.NotSupportedException:不支持“System.IntPtr”实例的序列化和反序列化。路径:$.TargetSite.MethodHandle.Value。---> System.NotSupportedException:不支持“System.IntPtr”实例的序列化和反序列化。
数据dto:
public class StockPositionBuyDto
{
public int Id { get; set; }
public int IdCurrency { get; set; }
public decimal Count { get; set; }
public decimal Price {get; set; }
public decimal Fee { get; set; }
}
public class StockTransaction
{
public int Id { get; set; }
public StockPosition Position { get; set; }
public string Type { get; set; }
public …Run Code Online (Sandbox Code Playgroud)