public static void Log(this LoanBase loan, string msg, DbContext context) { if (loan != null) { WriteLog($"{Environment.NewLine}Loan '{msg}' -- state = {context.Entry(loan).State} -- id = {loan.Id}"); loan?.Lender.Log(msg, context); loan?.LenderContact.Log(msg, context); } else { WriteLog($"{Environment.NewLine}Loan '{msg}' -- null"); } }
public static void LoanGraphStateShouldBe(this DbContext context, LoanBase loan, Microsoft.EntityFrameworkCore.EntityState state) { context.StateShouldBe(loan, state); context.StateShouldBe(loan.Lender, state); context.StateShouldBe(loan.LenderContact, state); }