Skip to content

EF Core Lazy Loading Proxy Support #146

@RaoulHolzer

Description

@RaoulHolzer

If we use EF Core Lazy Loading Proxy in the client the entities will not be added to the DatasyncOperationsQueue.

services.AddDbContextFactory( ( b) => b .UseLazyLoadingProxies());

public class LocalDataContext : OfflineDbContext

if we change an entity the DatasyncOperationsQueue doesn't find it in the entity map because it tries to find the CLR type like "Castle.Proxies.EntityProxy", but it should search the Metadta type like Model.Entity.

You could fix it if you change the method

internal List GetChangedEntitiesInScope()
=> ChangeTracker.Entries()
.Where(e => e.State is EntityState.Added or EntityState.Modified or EntityState.Deleted)
.Where(e => this._entityMap.ContainsKey(e.Metadata.Name.AsNullableEmptyString()))
.ToList();

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientImprovements or additions to the client code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions