llevo varios dias con un problema y no encuentro la solucion.
tengo una transacion con esta propiedad IsolationLevel = IsolationLevel.ReadCommitted
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }))
{
try
{
var CreatedsPdf = db.SoportePdfCreateds.Where(c => !c.IsCreated).Take(10).ToList();
Stopwatch sw = new Stopwatch();
sw.Start();
if (CreatedsPdf.Count > 0)
{
foreach (var item in CreatedsPdf)
{
if (item!=null)
{
string fecha = DateTime.Now.Date.ToString("dd_MM_yyyy");
PdfCreatorBase pdfCreatorBase = new PdfCreatorBase("SE" + item.SoporteEntrega.Guia + fecha + ".PDF");
byte[] bytesConvertBack = Convert.FromBase64String(item.PdfBytes64);
pdfCreatorBase.CreateSoporteEntregaPdf(item.SoporteEntregaId, bytesConvertBack);
item.IsCreated = true;
item.FechaCreacion = DateTime.Now;
db.Entry(item).State = EntityState.Modified;
}
}
db.SaveChanges();
sw.Stop();
scope.Complete();
}
pero en esta linea PdfCreatorBase pdfCreatorBase = new PdfCreatorBase("SE" + item.SoporteEntrega.Guia + fecha + ".PDF");
a pesar de que tengo una validación de que si es null me da el siguiente error :
Object reference not set to an instance of an object
No se si estoy usando mal el tipo de IsolationLevel, pero no le encuentro sentido.
muchas gracias