Models: Item and Reference (Note.Models...)
ViewModel: ItemReference (Note.Models.View.ItemReference)
View: ItemReference (Note.Views.ItemReference)
Controller: Item, ItemReference Action Method (Controllers.ItemController...)
Environment: Net Core 6 MVC, Visual Studio Community 2022 (64 bit), WIndows 11
Error:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Collections.Generic.List1[Note.Models.Item]', but this ViewDataDictionary instance requires a model item of type 'System.Collections.Generic.IEnumerable
1[Note.Models.View.ItemReference]'.
Change Made:
Set Models Navigation Properties and View to IEnumerable (pictured below)
**
Models** Navigation Properties set to IEnumerable
public IEnumerable<Attribution>? Attribution { get; set; }
/*public ICollection<Attribution>? Attribution { get; set; }*/ // original
ViewModel
using System.Net;
namespace Note.Models.View
{
public class ItemReference
{
public Item Item { get; set; }
public Reference Reference { get; set; }
Context
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Note.Models;
namespace Note.Data
{
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<Note.Models.Item>? Item { get; set; }
public DbSet<Note.Models.Reference>? Reference { get; set; }
public DbSet<Note.Models.Attribution>? Attribution { get; set; }
public DbSet<Note.Models.Forum>? Forum { get; set; }
}
}
View (no errors displayed)

Controller: ItemReference Action Method
// GET: Item
public async Task<IActionResult> ItemReference()
{
return _context.Item != null ?
View(await _context.Item.ToListAsync()) :
Problem("Entity set 'ApplicationDbContext.Item' is null.");
}
Result When Run:
Error: (Same as above)
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Collections.Generic.List1[Note.Models.Item]', but this ViewDataDictionary instance requires a model item of type 'System.Collections.Generic.IEnumerable
1[Note.Models.View.ItemReference]'.
If I set Model navigation properties and View all to ICollection
Model Navigation Properties
public ICollection<Attribution>? Attribution { get; set; } // original
View
@model ICollection<Note.Models.View.ItemReference>
Errors (red underline)

Severity Code Description Project File Line Suppression State
Error (active) CS1061 'ICollection<ItemReference>' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'ICollection<ItemReference>' could be found (are you missing a using directive or an assembly reference?) C:\Users\User1\Desktop_Tech_Notes_Tech\Tech\Note\Views\Item\ItemReference.cshtml 18