Исключение NullReferenceException EntityFrameworkCore (7.0.1)

Только начинаю изучать ASP.NET и EntityFrameworkCore, и у меня возникли проблемы со связями между таблицами. Хочу вивести таблицу Transactions, с полем Categories.Name и OperationTypes.Type и получаю NullReferenceException. Не могу понять в чем дело. Таблицу Categories выводит без проблем.

Файл Categories.cs

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace TryCreateDB.Models
{
    public class Categories
    {
        public Categories()
        {
            this.Transactions = new HashSet<Transactions>();
        }
        [Key]
        public int CategoryId { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public virtual ICollection<Transactions> Transactions { get; set; }
    }
}

Файл OperationTypes.cs

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace TryCreateDB.Models
{
    public class OperationTypes
    {
        public OperationTypes()
        {
            this.Transactions = new HashSet<Transactions>();
        }
        [Key]
        public int TypeId { get; set; }
        public string Type { get; set; }
        public virtual ICollection<Transactions> Transactions { get; set; }
    }
}

Файл Transactions.cs

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace TryCreateDB.Models
{
    public class Transactions
    {
        [Key]
        public int TransactionId { get; set; }
        public int CategoryId { get; set; }
        public int TypeId { get; set; }
        public double Amount { get; set; }
        public DateTime TransactionDate { get; set; }
        public string Description { get; set; }
        [ForeignKey("CategoryId")]
        public virtual Categories Categories { get; set; }
        [ForeignKey("TypeId")]
        public virtual OperationTypes OperationTypes { get; set; }
    }
}

Файл ApplicationContext.cs

using TryCreateDB.Models;
using Microsoft.EntityFrameworkCore;

namespace TryCreateDB.Data
{
    public class ApplicationContext : DbContext
    {
        public ApplicationContext(DbContextOptions<ApplicationContext> options): base(options) {
        }
        public DbSet<Categories> Categories { get; set; }
        public DbSet<OperationTypes> OperationTypes { get; set; }
        public DbSet<Transactions> Transactions { get; set; }
    }
}

Файл TransactionsController.cs

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TryCreateDB.Data;
namespace TryCreateDB.Controllers
{
    public class TransactionsController : Controller
    {
        private readonly ApplicationContext _context;
        public TransactionsController(ApplicationContext context)
        {
            _context = context;
        }
        public async Task<IActionResult> Index()
        {
            return View(await _context.Transactions.ToListAsync());
        }
    }
}

Ответы (0 шт):