arche89 arche89 - 1 month ago 18
C# Question

Code generator error: There is no entity type on DbContext

I want to create simple ASP.NET Core App. But when I'm trying to generate API Controller for my model I'm getting following error:
(Screen shots presents code for model class and db context, below is code for EntityBase class)

Setting up code scaffolding properties

Error

public abstract class EntityBase
{
[Key]
public int Id { get; set; }
public DateTime Modified { get; set; }
public DateTime Created { get; set; }

public EntityBase()
{
Created = DateTime.Now;
Modified = Created;
}
}

Answer

Ok, so I found what was causing this error. I created Many to Many relationship between Convent and Group without using third class. I used to use fluent api to do that.

Thanks all for help!