expressappframework-404519-debugging-testing-and-error-handling-code-diagnostics-xaf0031.md
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.
See the Startup.cs file in YourSolutionName.Blazor.Server and YourSolutionName.Win projects:
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();
});
}
public static WinApplication BuildApplication(string connectionString) {
// ...
builder.ObjectSpaceProviders
.AddEFCore(options => options.PreFetchReferenceProperties())
.WithDbContext<YourSolutionName.Module.BusinessObjects.YourSolutionNameEFCoreDbContext>((application, options) => {
options.UseSqlServer(connectionString);
options.UseObjectSpaceLinkProxies();
})
.AddNonPersistent();
// ...
}
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();
});
}
public static WinApplication BuildApplication(string connectionString) {
// ...
builder.ObjectSpaceProviders
.AddEFCore(options => options.PreFetchReferenceProperties())
.WithDbContext<YourSolutionName.Module.BusinessObjects.YourSolutionNameEFCoreDbContext>((application, options) => {
options.UseSqlServer(connectionString);
options.UseChangeTrackingProxies();
options.UseObjectSpaceLinkProxies();
})
.AddNonPersistent();
// ...
}