0

I have a State model class:

public class State
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int CountryId { get; set; }
    public virtual Country Country { get; set; }
}

And I am trying to create a Repository:

Scaffold Repository State

I've got in generated file:

public IQueryable<State> All
{
    get { return context.State; }
}

instead of context.StateS.

Property

public DbSet<State> States { get; set; }

successfully has been added to the DbContext class.

I have no overrided OnModelCreating method.

Sometimes I mention such problem in different projects but can not find a reason.

sashaeve
  • 9,387
  • 10
  • 48
  • 61

1 Answers1

0

I know I've had problems with namespace confusion when using the word "State" for my database tables and POCOs. So to make things easier, I rename those to something else, like USState or StateCode. That could be what's going on here for you and the scaffolding.

Michael Cox
  • 1,281
  • 13
  • 15