c# - Redis .StoreAll 类型为 'System.StackOverflowException' 的未处理异常发生在 mscorlib.dll 中

标签 c# redis

我正在使用 Redis,但 StoreAll 不起作用。

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

var newOrders = (from i in DB.Produtoes.OrderByDescending(d => d.idProduto) select i);
using (var produtosRedis = redisClient.GetTypedClient<Produto>())
{
    produtosRedis.StoreAll(newOrders);
}

最佳答案

您遇到的是由 StoreAll() 使用的 Json 序列化引起的循环引用。

这些帖子将帮助您:

  1. Preventing StackOverflowException while serializing EF object graph into Json
  2. EntityFramework to Json workaround?

关于c# - Redis .StoreAll 类型为 'System.StackOverflowException' 的未处理异常发生在 mscorlib.dll 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10031996/

相关文章:

Redis启动后是空的,虽然有一个.rdb文件

c# - 在没有标题的情况下将 CSV 文件读入数据集

c# - 函数式编程和解耦

c# - 错误 : Does not implement interface member

c# - 泛型的继承

c# - 使用 WEB API 和 Entity Framework 项目的 IIS 本地计算机上的 "The underlying provider failed to Open"异常

architecture - socket.io广播功能& Redis pub/sub架构

redis - 重新启动代理后重新启动 celery 队列

php - Redis Multi 保证原子性

laravel - 缓存 Redis 'Exception',消息为 'Serialization of ' Closure' is not allowed'