鉴于网上的此类文章讲的不那么好,特在此重新讲一下

创建一个.Net Core控制台程序,本文代码需要Nuget包Newtonsoft。安装后就可以开始了
首先交代一下使用的类

public abstract class EntityBase
{
    public virtual long Id { get; set; }
}

public class Entity : EntityBase
{
    public override long Id { get; set; }
    public string Name { get; set; }
    [MyJsonIgnore]
    public decimal Money { get; set; }
    public Category Category { get; set; }
    public List<Child> Children { get; set; }
}

public class Child : EntityBase
{
    public string Name { get; set; }
}

public enum Category
{
    Human = 0,
    Cat = 1,
    Dog = 2
}
作为模型的类

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2021-10-11
  • 2021-07-20
  • 2021-09-12
  • 2021-12-16
  • 2021-11-15
猜你喜欢
  • 2021-09-05
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-11-10
相关资源
相似解决方案