我正在使用 RedisClientManager 并且我正在尝试设置对象时在 mscorlib.dll 错误中发生“System.StackOverflowException”类型的未处理异常
client.Set<ApplicationUser>(user.Id, user);
和用户:
public class ApplicationUser : IdentityUser
{
public string Name { get; set; }
public string Surname { get; set; }
public DateTime? BirthDay { get; set; }
public int BirthPlace { get; set; }
public int TeamId { get; set; }
public int AvatarId { get; set; }
public string Address { get; set; }
public DateTime RegisterationDate { get; set; }
public DateTime CodeSendDate { get; set; }
public string ActivationCode { get; set; }
public string PasswordResetToken { get; set; }
public string FacebookAvatar { get; set; }
public string FacebookId { get; set; }
public bool UseFacebookAvatar { get; set; }
public string IpAddress { get; set; }
public virtual Avatar Avatar { get; set; }
public ApplicationUser()
{
this.Coupons = new HashSet<Coupon>();
}
[JsonIgnore]
public virtual ICollection<Coupon> Coupons { get; set; }
}
序列化ApplicationUser时发生错误,我尝试添加[JsonIgnore]
ICollection,因为嵌套循环,(优惠券包含用户)我找不到什么问题?