I am doing some discovery in a small test project and am trying to have a breakpoint hit in the configuration definition class.
public class TripExpenseComparisonEntityTypeConfiguration : IEntityTypeConfiguration<TripExpenseComparison>
{
public void Configure(EntityTypeBuilder<TripExpenseComparison> builder)
{
builder.HasKey(u => u.Id)
.HasName("PK_TravelExpense");
builder.OwnsOne(vo => vo.BudgetedTripExpense, exp =>
{
var x = from p in exp.GetType().GetProperties() where p.PropertyType == typeof(decimal) select p;
exp.Property(u => u.AllowNegatives)
.IsRequired();
exp.Ignore(u => u.TotalExpenses);
});
... rest removed
When I run Add-Migration from the package manager console, in the DataAccess project, it runs the entire migration (correctly) EXCEPT it doesn't hit the breakpoint set on this line
>exp.Property(u => u.AllowNegatives)
.IsRequired();
Do breakpoints not function in this type of class? Or do they not get hit during an add-migration event?
CodePudding user response:
You can add this line Debugger.Launch();
before the required place. It launches and attaches a debugger to the process.
See the documentation here.
Another option you run the migration using DbMigrator
through code and debug.