Skip to main content
All docs
V24.2
.NET 8.0+

XAF0031: Add the UseChangeTrackingProxies() call for automatic UI updates

Severity: Warning

Enable the DbContextOptionsBuilder.UseChangeTrackingProxies() option for automatic UI updates and change notifications from business object setters.

For more information, refer to the following topic: PropertyChanged and CollectionChanged Event in Entity Framework Core.

Examples

See the Startup.cs file in YourSolutionName.Blazor.Server and YourSolutionName.Win projects:

Invalid Code

public void ConfigureServices(IServiceCollection services) {
    services.AddXaf(Configuration, builder => {
        // ...
        builder.ObjectSpaceProviders
            .AddEFCore(options => options.PreFetchReferenceProperties())
                .WithDbContext<YourSolutionName.Module.BusinessObjects.YourSolutionNameEFCoreDbContext>((serviceProvider, options) => {
                    // ...
                    options.UseSqlServer(connectionString);
                    options.UseObjectSpaceLinkProxies();
                    options.UseLazyLoadingProxies();
                })
            .AddNonPersistent();
    });
}

Valid Code

public void ConfigureServices(IServiceCollection services) {
    services.AddXaf(Configuration, builder => {
        // ...
        builder.ObjectSpaceProviders
            .AddEFCore(options => options.PreFetchReferenceProperties())
                .WithDbContext<YourSolutionName.Module.BusinessObjects.YourSolutionNameEFCoreDbContext>((serviceProvider, options) => {
                    // ...
                    options.UseSqlServer(connectionString);
                    options.UseChangeTrackingProxies();
                    options.UseObjectSpaceLinkProxies();
                    options.UseLazyLoadingProxies();
                })
            .AddNonPersistent();
    });
}