0

i am facing a strange issue, i have a code, which was working before few months ago, after that i stopped working on it and then i reinstall my window. after that when i tried to run the code by restoring the DB on my local server. it through me following error:

No mapping specified for the following EntitySet/AssociationSet - Entity1?

i fixed this issue by following the below: This

Now the project build successfully but now its saying table names are not able to find in context. it changed the name by itself and code has some other names like for one table named "employees" it becomes "employee".

I am not able to get why i am facing this issue, and this code was working perfectly.

any have any idea, what could be the reason.

Community
  • 1
  • 1
Ram Singh
  • 6,664
  • 35
  • 100
  • 166

2 Answers2

0

When you created your new edmx model you may have checked singular/pluralize entities. You may want to recreate your model by checking/unchecking this as i've had this issue in the past before as well.

enter image description here

tshoemake
  • 1,311
  • 1
  • 17
  • 28
0

override the OnModelCreating method and remove that ā€œPluralizingTableNameConventionā€ convention. So you are telling Entity Framework not to pluralise table names, simply add

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {    
     modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
 }
MMM
  • 3,132
  • 3
  • 20
  • 32