I have a parent child relationship with a reference constraint so that a delete of the parent fails if the record has children.
A simple delete statement of a parent record with children fails as expected in SSMS, yet I am able to delete the record in my Radzen app: it acts as if I had configured a cascade delete.
The .Include is no longer necessary!? from EF core 2.1 they have lazy loading as an option.
This feature was introduced in EF Core 2.1.
The simplest way to use lazy-loading is by installing the Microsoft.EntityFrameworkCore.Proxies package and enabling it with a call to UseLazyLoadingProxies. For example:
C#
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString);
Or when using AddDbContext:
C#
.AddDbContext<BloggingContext>(
b => b.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString));
Perhaps this solves the problem?
Or is it corrected in the actual version of Radzen?
The delete behavior configured in the EF Core model is only applied when the principal entity is deleted using EF Core and the dependent entities are loaded in memory