DbContext.set() cannot create a DbSet for entity because this type is not included in the model for the context

asp.net-core entity-framework-6 entity-framework-core

Question

I'm using zzz-5 zzz. I useDbContext.Set() yet, I'm getting the problem "Cannot build a DbSet for 'MediaDate' since this type is not included in the model for the context."

Here's my code:

var context = new GoldentaurusContext();
DbSet<MediaDate> set = context.Set<MediaDate>();
mediaDateList = set.FromSql("[dbo].[sp_GetMediaDate]")
                .Select(x => new SelectListItem { Text = x.DateText, Value = x.DateValue })
                .ToList();

The class MediaDate:

public class MediaDate
{
    public string DateText { get; set; }
    public string DateValue { get; set; }
}

enter image description here

Why is the MediaDate class needed in addition to the DbContext class?

Please tell me what I'm doing incorrectly.

1
5
5/10/2018 4:05:29 PM

Popular Answer

ZZZ_tmp
2
8/16/2019 7:28:39 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow