0

I´m using Redis, but the StoreAll doesn´t work.

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);
}
yoozer8
  • 7,361
  • 7
  • 58
  • 93
Fernando JS
  • 4,267
  • 3
  • 31
  • 29

1 Answers1

2

What you've encountered is a circular reference caused by the Json serialization used by StoreAll().

These posts will help you:

  1. Preventing StackOverflowException while serializing EF object graph into Json
  2. EntityFramework to Json workaround?
Community
  • 1
  • 1
Ofer Zelig
  • 17,068
  • 9
  • 59
  • 93