This works not with the current version of EF.Extended.
EntityFramework.Extended Update not working - can't convert DynamicProxy
-
13-04-2022 - |
Pregunta
I am using Entity Framework 6 and tried to use EntityFramework.Extended to do some batch updates:
db.TicketOrderItems
.Where(i => !i.IsDeleted && !i.Order.IsCompleted && i.Order.OrderDate < margin)
.Update(i => new TicketOrderItem { IsDeleted = true });
TicketOrderItem is an extension of OrderItem. When this is now executed I get the following error (translated from german, as I get it in german):
The EntityFramework.Reflection.DynamicProxy-type can not implicitly be converted
to System.Data.Objects.ObjectQuery<NAMESPACE.TicketOrderItem>.
I already disabled lazy loading and proxy generation (and verified it via debugging, that no proxies are generated):
db.Configuration.LazyLoadingEnabled = false;
db.Configuration.ProxyCreationEnabled = false;
Is there a way to fix that?
Or is this a bug in the "not yet final" EF 6 or an incompability between EF.Extended and EF 6?
Solución 2
Otros consejos
Looks like EntityFramework.Extended doesn't work with EF 6 yet. Some of EF namespace changes are causing the problem. You can pull the extended source, remove the old EF reference and change the EF related namespaces from
using System.Data.*;
to
using System.Data.Entity.Core.*;