Closed dotcom9 closed 5 years ago
Thank you @dotcom9 for reporting,
We will look if that's possible for us or not to support the method Reload
.
Best Regards,
Jonathan
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions • Entity Framework Classic • Bulk Operations • Dapper Plus
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function • SQL Eval Function
Hello @dotcom9 ,
We tried your code asynchronously and without async and everything seems to work on our side.
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Effort.Lab.EF6
{
public class Request_Reload
{
public static void Execute()
{
var connection = Effort.DbConnectionFactory.CreateTransient();
using (var context = new EntityContext(connection))
{
var entitySimple = new EntitySimple {ColumnInt = 1};
context.EntitySimples.Add(entitySimple);
context.EntitySimples.Add(new EntitySimple { ColumnInt = 2 });
context.EntitySimples.Add(new EntitySimple { ColumnInt = 3 });
context.SaveChanges();
var entry = context.Entry(entitySimple);
entry.Reload();
}
}
public class EntityContext : DbContext
{
public EntityContext(DbConnection connection) : base(connection, true)
{
}
public DbSet<EntitySimple> EntitySimples { get; set; } }
public class EntitySimple
{
public int ID { get; set; }
public int ColumnInt { get; set; }
}
}
}
Could you provide a full example as we did with the issue?
Best Regards,
Jonathan
Description
When a row is added to a table, it is common to want to refresh the object to pick up auto-generated field values, related objects specified by foreign keys and so on. Effort currently does not support this scenario. Methods of the DbEntityEntry object that is retrieved from
DbContext.Entry(object)
fail with anInvalidOperationException
against an Effort context.Project
Database context creation:
Repository method:
Unit Test
Exception
The following exception is thrown when
entry.Reload()
is called in the repository method, above.Further technical details