小编DOD*_*ODO的帖子

Net core 6 序列化和反序列化异常

我创建了一个 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)

c# entity-framework-core asp.net-core

6
推荐指数
1
解决办法
6499
查看次数

标签 统计

asp.net-core ×1

c# ×1

entity-framework-core ×1